React example of rendering void elements incorrectly

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

by remarkablemark

HTML

<div id="root"></div>

<!-- React + ReactDOM -->
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>

Babel + JSX

ReactDOM.render(
	/**
   * When img is not treated as a void element, the following error will be thrown:
   * ```
   * Uncaught Error: img is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.
   * ```
   * See documentation on void elements for more information: https://www.w3.org/TR/html5/syntax.html#void-elements
   */
	<div>
	  <img>content</img>
	</div>,
  /**
   * To fix the code above, make img self-closing:
   * ```jsx
   * <div>
   *   <img />content
   * </div>
   * ```
   */
	document.getElementById('root')
);