Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Minified React error #418 and #423 in Next.js v12.3.1 with React v18.2.0"

After major updates, I started encountering the following errors in my application:

Uncaught Error: Minified React error #418; visit https://reactjs.org/docs/error- 
decoder.html?invariant=418 for the full message or use the non-minified dev environment 
for full errors and additional helpful warnings.

Uncaught Error: Minified React error #423; visit https://reactjs.org/docs/error- 
decoder.html?invariant=423 for the full message or use the non-minified dev environment 
for full errors and additional helpful warnings.

These errors don't specify the exact component or code causing the issue, and I'm having trouble pinpointing the source of the problem in my application.

Environment:

Next.js version: 12.3.1 React version: 18.2.0

My question is :

What steps can I take to identify/fix the specific component or code causing these minified React errors?

please refer to the image below: enter image description here

like image 576
Kiraahmad Avatar asked Oct 24 '25 07:10

Kiraahmad


1 Answers

after a couple of days I was able to finally find 2 solutions to these 2 errors:

  1. downgrade current react version from v18 to v17.0.2
  2. I had several components/functions that are being used by context provider so I dynamically imported all those components, providers and even a function that triggers an API call, so first you import dynamic from next.js like the following :
  • import dynamic from 'next/dynamic';
  • const ExampleComponent = dynamic(() => import("./path/toComponent"));

these 2 methods solved both errors for me, if you decide to choose second option you do not need to downgrade your react version. I hope someone finds these helpful

like image 88
Kiraahmad Avatar answered Oct 26 '25 22:10

Kiraahmad



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!