Do I have to use valid HTML tags when creating JSX elements?

Question

Do I have to use valid HTML tags when creating JSX elements?

Answer

When creating JSX elements, not components, we should be using valid HTML tags - that said, React uses some DOM properties/attributes differently than in HTML. Be sure to check the React documentation when adding HTML attributes to JSX elements to make sure that 1. the syntax is correct and 2. the attribute behavior is as expected.

9 Likes