How to Fix "meta is a void element tag and must neither have children nor use dangerouslySetInnerHTML" Error

Published Feb 7, 2022  ∙  Updated May 2, 2022

I came across this error when compiling my Next.js/React.js application.

Error: meta is a void element tag and must neither 
have `children` nor use `dangerouslySetInnerHTML`.

This is quite a suspiciously vague error message, but the solution is quite simple.

The specified tag (meta in this case) needs to be self-closing.

My <meta> tag looked like this.

<meta></meta>

We want self-closing tags.

<meta/>

The same goes for other elements such as <input>.