-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
feat: React 18 + automatic JSX runtime + build --dev #8961
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Size Change: +31.7 kB (+3%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
Would it also be possible to set the React runtime to
It turns out that if you specify Even if we were to ignore the issue above, with React 18 I'm not sure why you'd ever want to use the classic runtime instead of automatic anyway. |
When will react 18 be supported? |
@NMinhNguyen I turned on the automatic JSX runtime as part of this PR @luhc228 it will be supported very soon in canary releases, this PR is ready and will be merged very soon |
Great, thank you! |
Anyone get
normalization.mdtitle: Entity and Data Normalization
|
Breaking changes
typeof window === "undefined"
(orExecutionEnvironment. canUseDOM
) during the render phase (including useMemo, useCallback, useState initial value...), and prefer using our dedicated hook useIsBrowser). Read The Perils of Hydration to better understand the problem. You can get better error messages when building with the new--dev
option.@docusaurus/tsconfig
(see feat: create official TypeScript base config @docusaurus/tsconfig #9050)startTransition
for React hydration (in PR perf(core): use React 18 startTransition for hydration #9051)Caution - Suspense and new features.
This PR upgrades React to v18 as a dependency. Please let us some time to experiment with the new React 18 features before introducing them to your codebase. It is possible that those features will not work as you expect:
<Suspense>
React.lazy()
useTransition()
+startTransition()
We will let you know later once it's safe to use these new APIs inside Docusaurus.
Motivation
Main changes:
npm run build --dev
option to turn on full React error messages, useful for debugging hydration issuesUseful links:
Other notable changes in this PR:
useIsomorphicLayoutEffect
in core (undocumented, temporary until React 19?)Related issues:
Test Plan
tests + preview + argos + react-18 test page + dogfood
Test links
https://deploy-preview-8961--docusaurus-2.netlify.app/tests/pages/react-18
Related issues/PRs
Previous React 18 PRs:
Related links:
Useful docs links:
Inspirations to transform
renderToPipeableStream
to something awaitable for SSG: