-
Notifications
You must be signed in to change notification settings - Fork 82
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 19 #865
Open
imjordanxd
wants to merge
4
commits into
algolia:master
Choose a base branch
from
imjordanxd:react-19
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
React 19 #865
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Great! This would be much appreciated! 🙏 |
imjordanxd
commented
Dec 17, 2024
@@ -7,7 +7,7 @@ | |||
/* eslint-disable react/no-string-refs */ | |||
|
|||
import React, { Fragment, Component } from 'react'; | |||
import { createRenderer } from 'react-test-renderer/shallow'; | |||
import ShallowRenderer from 'react-shallow-renderer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this import crashes the test runner for some reason
update: it's because it depends on React internals and they've changed between majors. I wonder can the tests that depend on this be deleted. Not entirely sure what value they provide
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.