Description
Describe the bug
Warning is printed to console:
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
While this itself is not breaking, it does provide a very jarring developer experience to have that kind of error out of the box. This could be particularly confusing or worrisome to new developers or developers new to React.
Did you try recovering your dependencies?
I manually reverted back to 17.0.2 for both React and ReactDom
Which terms did you search for in User Guide?
This seems entirely related to the new React 18 that was just released a few days ago, so there wasn't any relevant information in the docs/user guide. I did see a few other related issues like #12239, stemming from the same issue of using React 18 but not fully preparing CRA to handle it. It seems this could signal more upcoming issues in the near future if CRA continues to use React 18.
Environment
current version of create-react-app: 5.0.0
System:
OS: Windows 10 10.0.19043
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Binaries:
Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.55)
Internet Explorer: 11.0.19041.1566
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
( Again please note that I've since reverted to react/dom to 17.0.2, but when the CRA was fresh installed it was ^18 )
Steps to reproduce
(Write your steps here:)
- Start a simple boilerplate fresh app with npx create-react-app app-name
- Fire up the app with npm start
- Look at console and see warning
Expected behavior
I'd expect either the default boilerplate to use the new createRoot + root.render approach, or for CRA to default to the previous version of React.
Actual behavior
Received this warning in the console.
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
Activity
kyletsang commentedon Apr 4, 2022
Duplicate of #12219 and this will be fixed in #12220
KenAKAFrosty commentedon Apr 4, 2022
Awesome thanks