Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support React 18's new client side rendering #1151

Merged
merged 2 commits into from
Dec 19, 2021

Conversation

kylemellander
Copy link
Contributor

Summary

React 18 is changing the way that client-side components are rendered and hydrated. See reactwg/react-18#5

In order to create a path forward to using React 18, this adds support for both methods of hydrating and rendering so that newer React features can be used while maintaining full backward compatibility.

Other Information

I did not add any specific tests for this because there was no clear way to test for different versions of React. This seems like it should be explored in separately.

With React 18, the rendering interface will be updated in order to benefit from new features. reactwg/react-18#5

This allows React 18 rendering to be supported while creating backwards compatibility.

For the time being, the return of the components does not change the output from the previous versions so as to not cause any breaking changes.
Copy link
Member

@BookOfGreg BookOfGreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a second to understand why legacyReactRootLike was written the way it was, its clever. 👍

@BookOfGreg BookOfGreg merged commit ed13a3e into reactjs:master Dec 19, 2021
@kylemellander kylemellander deleted the react-18-prep branch December 20, 2021 18:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants