Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Next js, ReactDom.render is no longer supported

I just spun up a new Next JS app with Next 12.

I am getting this error on all page loads in the browser:

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

Next js's ReactDom.render is under the hood, how can I resolve this error?

like image 888
Davi Caamano Avatar asked May 10 '26 18:05

Davi Caamano


2 Answers

For me it was indeed Chakra. You need to Install the latest Chakra ui for NextJS

npm i @chakra-ui/[email protected]
like image 168
Random Cell Avatar answered May 12 '26 09:05

Random Cell


You may also get this warning if you've updated to React 18 and are using a custom server setup in your Next.js app.

For this case, the issue has been addressed in this PR in version 12.1.7-canary.2. To fix it in your project simply update Next.js to version >=12.2.0.

npm install next@latest
like image 33
juliomalves Avatar answered May 12 '26 08:05

juliomalves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!