-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix: compatibility with react rc 2 #35108
Conversation
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 looks good to me, but I'd recommend getting another set of eyes for approval. 😄
One thought for potential future refactor: is there any way we could pull out the renderer/hydrator logic into a common factory-type class? This subject is a bit in-the-weeds-y and I could see more duplicated logic with new plugins in the future.
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.
Two smaller things.
Also, what's up with the empty file packages/gatsby/cache-dir/react-dom-switcher.js
packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx
Outdated
Show resolved
Hide resolved
|
||
root.render(Component) | ||
|
||
return root |
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.
Maybe I'm missing some context here, but why is with React 18 the reactRender returning something, with older version it's void
?
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.
Because Root doesn't exist in React < 18 and we need the root so we only call createRoot once.
…er.tsx Co-authored-by: Lennart <lekoarts@gmail.com>
Description
Fixes support for React 18 latest RC.
Related Issues
Fixes #35095
Fixes #35083
Fixes #35094
[sc-47335]