Rules
no-void-elements-with-children
Full Name in eslint-plugin-react-dom
Full Name in @eslint-react/eslint-plugin
Features
🔍
Presets
dom
recommended
recommended-typescript
recommended-type-checked
What it does
Prevents the use of children
in void DOM elements
.
Self-closing HTML elements (e.g. <img />
, <br />
, <hr />
) are collectively known as void DOM elements. React will give you a warning if you try to give these children:
Invariant Violation: img is a void element tag and must neither have children nor use dangerouslySetInnerHTML.