-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[labs/react] ReactElement base class for making web components from React components #2353
Comments
I was literally just thinking about this yesterday. After playing around with the very cool support now in React 18 experimental, I wondered "well, if we can stick web components inside of React components now, what about sticking React components inside of web components?!" Glad to see someone pick this up. 😁 |
That would be a fantastic feature for us https://github.com/pie-framework/pie-elements; we're looking into adopting Lit for the next major version of our framework, and it would be of great help if we could adapt our existing (React based) components and port these components gradually. |
Has there been any movement towards integrating this feature (using React components in web components)? |
Like the inverse of
createComponent()
, we should vend a utility to easily wrap React components in web components.This would likely be a subclass of ReactiveElement that calls
ReactDOM.render()
with the result of callingthis.render()
, very much like this PreactElement sketch here: https://stackblitz.com/edit/preact-element?file=preact-element.tsComponent props would be wired in from declared reactive properties. Events and event-like-callbacks could be exposed as properties, or more idiomatically, given callbacks that dispatch real DOM events.
Example
The text was updated successfully, but these errors were encountered: