Replies: 2 comments
-
Please post a full reproduction case. I'm afraid the vite config alone is not enough to reproduce the error on our end. According to the error message you're trying to render Preact nodes in React somewhere. That is not supported. Only the other way around is, rendering React components in Preact. |
Beta Was this translation helpful? Give feedback.
-
This is fundamentally how component frameworks work, you cannot bring components from one framework and use them directly in another. Each framework has certain expectations around components from construction to output and this is not universally shared. Preact, with its compatibility layer, is fairly unique here in that it handles the conversion of a React component into a Preact component for you. However, there is a conversion going on to facilitate that, just one behind the scenes. To fulfill your use case you have two options:
|
Beta Was this translation helpful? Give feedback.
-
I am encountering the following error when using a Preact component in my React project:
Uncaught Error: Objects are not valid as a React child (found: object with keys {type, props, key, ref, __k, __, __b, __e, __c, constructor, __v, __i, __u, __source, __self}). If you meant to render a collection of children, use an array instead.
I'm trying to create a components library using Preact and use it in a React projects.
but after building the project I got the previous mentioned error.
here is my vite config.
tsconfig.json
Beta Was this translation helpful? Give feedback.
All reactions