Unverified Commit 757ab17e authored by Abhishek Mardiya's avatar Abhishek Mardiya Committed by GitHub

In-Depth Explanation of React Version Handling Doc (#89426)

There have been multiple discussions and some confusion around [React
version handling](https://nextjs.org/docs#react-version-handling) in
Next.js. This PR adds an in-depth explanation to clarify how React and
react-dom versions are managed internally, and why they still need to be
declared in package.json.

The goal is to help developers better understand this behavior and
reduce recurring questions around it.

Reference discussion:
https://github.com/vercel/next.js/discussions/87958

@icyJoseph

---------
Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: 's avatarJoseph <sephxd1234@gmail.com>
Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
parent 351a6752
...@@ -126,7 +126,10 @@ yarn add next@latest react@latest react-dom@latest ...@@ -126,7 +126,10 @@ yarn add next@latest react@latest react-dom@latest
bun add next@latest react@latest react-dom@latest bun add next@latest react@latest react-dom@latest
``` ```
> **Good to know**: The App Router uses [React canary releases](https://react.dev/blog/2023/05/03/react-canaries) built-in, which include all the stable React 19 changes, as well as newer features being validated in frameworks. The Pages Router uses the React version you install in `package.json`. > **Good to know**:
>
> - The `App Router` uses [React canary releases](https://react.dev/blog/2023/05/03/react-canaries) built-in, which include all the stable React 19 changes, as well as newer features being validated in frameworks, but you should still declare react and react-dom in package.json for tooling and ecosystem compatibility.
> - The `Pages Router` uses the React version from your `package.json`.
Then, add the following scripts to your `package.json` file: Then, add the following scripts to your `package.json` file:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment