How to solve Minified React error #418

Oscar de la Hera Gomez
Two flowers that represent ReactJS and GatsbyJS, beneath them sits the text "Minified React Error #418 Solution."

A solution for "Hydration failed because the initial UI does not match what was rendered on the server."

A screenshot of the Chrome inspector showing the minified react error 418.

The #418 React Minified Error in the Inspector.

Years after the development of the delasign.com website, we discovered that an error had appeared that we hadn't previously seen.

A screenshot of the ReactJS webpage that describes the error. The error 418 can be described as "Hydration failed because the initial UI does not match what was rendered on the server."

The React Decoder Error Description

The error appeared in all pages and when clicking the link on the inspector it led to the page above.

A screenshot of VSCode showing the "if typeof window === undefined return a div" code that was created the Minified React Error #418.

If you return a div if the window is undefined, you will produce a Minified React Error #418.

After careful analysis, we discovered that the error was due to our codebase blocking GatsbyJS from rendering all the code at build time.

The error was caused by an if statement that required the window to exist (i.e. not be undefined) in order to render our navigation bar and footer.

This pushed React to return a #418 error on every page which simultaneously harmed our Largest Contentful Paint by 5 seconds and damaged our SEO.

Looking to learn more about ReactJS and SEO ?

Search our blog to find educational content on learning ReactJS and SEO.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details