Skip to content
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

[React 18] Update to be compatible. #80

Closed
wants to merge 3 commits into from

Conversation

lreddickGNA
Copy link

@lreddickGNA lreddickGNA commented Sep 8, 2022

Updating ReactDOM.render to the new createRoot function specified in the React 18 upgrade.

This PR only updates custom_elements.js which is what I'm using in my Rails application. Work still needs to be done for mutation_obersver.js

@rstacruz
Copy link
Owner

rstacruz commented Sep 8, 2022

Thanks, I was really having trouble getting React 18 to work myself. Is this ready for review?

@lreddickGNA
Copy link
Author

@rstacruz At least the implementation of this so far works for my production build. I couldn't get the testing to work locally- and I believe the testing would also need an update. But it's more or less ready for review.

@lreddickGNA
Copy link
Author

lreddickGNA commented Sep 9, 2022

Yea it looks like you'd want to update mutation_observer.js since onUnmount and onUpdate events are used in there and I'm no longer taking the mountPoint as a parameter... instead you need to pass the root object.

Just updated in latest commit.

@rstacruz
Copy link
Owner

Thanks for this! I'll try to look into this when I have time -- one thing we will need to update is all documentation.

@rstacruz
Copy link
Owner

Interesting - looks like the way this works is it creates a hard dependency on React, and prevents implementing custom adapters for non-React frameworks.

I think that might be alright - I'm not sure if anyone uses Remount in that way (would love to hear if anyone knows!) and we may have to remove that feature altogether.

(...either that, or implement it in a way that doesn't change the signature of custom adapters)

@rstacruz
Copy link
Owner

There's also a few tests that might need to be updated - looks like the *.html tests still reference react@16 🤔

@rstacruz
Copy link
Owner

Also it looks like the shadow DOM workarounds provided in react-shadow-dom-retarget-events will no longer be needed :)

@rstacruz rstacruz mentioned this pull request Sep 21, 2022
@rstacruz
Copy link
Owner

Thanks for your contribution! I continued it on a bit over at #81 - hopefully it should be a bit more comprehensive :)

@lreddickGNA
Copy link
Author

Closing since this has been moved to #81

@rstacruz
Copy link
Owner

React 18 support is now out in remount@1.0.0 - https://github.com/rstacruz/remount/releases/tag/v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants