Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds support for React 19. I don't have a lot of time to add this and would appreciate any help 🙏
New context rendering
In React 19, we can render a context as follows:
The React Element produced by this is identical (as far as I can see!) to the React Element produced if we were to render:
Because of this change, serialisation is broken. We don't know how a context was rendered. Therefore, we can't produce a JSX string that accurately reflects the original JSX that was written. To support a wide range of React versions, we should serialise the new context rendering (
<Context>...</Context>
) as<Context.Provider>...</Context.Provider>
. This isn't exactly a 1:1 serialisation but React will still treat the JSX the same.Furthermore, the element type symbols have changed between React major versions. For example:
This means we cannot bundle
react-is
as a dependency and allow a wide range or React peer dependencies. We should expect consumers of this package to providereact-is
as a dependency which is aligned to their React version. This is a breaking change.