Skip to content

Commit 499b37e

Browse files
committed
Add read more link
1 parent 41fa29d commit 499b37e

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

errors/react-version.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Minimum React Version
2+
3+
#### Why This Error Occurred
4+
5+
Your project is using an old version of `react` or `react-dom` that does not
6+
meet the suggested minimum version requirement.
7+
8+
Next.js suggests using, at a minimum, `react@16.10.0` and `react-dom@16.10.0`.
9+
Older versions of `react` and `react-dom` do work with Next.js, however, they do
10+
not enable all of Next.js' features.
11+
12+
For example, the following features are not enabled with old React versions:
13+
14+
- [Fast Refresh](https://nextjs.org/docs/basic-features/fast-refresh): instantly
15+
view edits to your app without losing component state
16+
- Component stack trace in development: see the component tree that lead up to
17+
an error
18+
- Hydration mismatch warnings: trace down discrepancies in your React tree that
19+
cause performance problems
20+
21+
This list is not exhaustive, but illustrative in the value of upgrading React!
22+
23+
#### Possible Ways to Fix It
24+
25+
**Via npm**
26+
27+
```bash
28+
npm upgrade react@latest react-dom@latest
29+
```
30+
31+
**Via Yarn**
32+
33+
```bash
34+
yarn add react@latest react-dom@latest
35+
```
36+
37+
**Manually** Open your `package.json` and upgrade `react` and `react-dom`:
38+
39+
```json
40+
{
41+
"dependencies": {
42+
"react": "^16.10.0",
43+
"react-dom": "^16.10.0"
44+
}
45+
}
46+
```
47+
48+
### Useful Links
49+
50+
- [Fast Refresh blog post](https://nextjs.org/blog/next-9-4#fast-refresh)
51+
- [Fast Refresh docs](https://nextjs.org/docs/basic-features/fast-refresh)

packages/next/cli/next-dev.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ const nextDev: cliCommand = (argv) => {
6969
})
7070
if (reactVersion && semver.lt(reactVersion, '16.10.0')) {
7171
Log.warn(
72-
'Fast Refresh is disabled in your application due to an outdated `react` version. Please upgrade 16.10 or newer!'
72+
'Fast Refresh is disabled in your application due to an outdated `react` version. Please upgrade 16.10 or newer!' +
73+
' Read more: https://err.sh/next.js/react-version'
7374
)
7475
} else {
7576
const reactDomVersion: string | null = await getPackageVersion({
@@ -78,7 +79,8 @@ const nextDev: cliCommand = (argv) => {
7879
})
7980
if (reactDomVersion && semver.lt(reactDomVersion, '16.10.0')) {
8081
Log.warn(
81-
'Fast Refresh is disabled in your application due to an outdated `react-dom` version. Please upgrade 16.10 or newer!'
82+
'Fast Refresh is disabled in your application due to an outdated `react-dom` version. Please upgrade 16.10 or newer!' +
83+
' Read more: https://err.sh/next.js/react-version'
8284
)
8385
}
8486
}

0 commit comments

Comments
 (0)