How are events different in JSX?
HTML uses lowercase attributes like onclick with string values. JSX uses camelCase like onClick and passes a function as the handler, not a string.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in JSX vs HTML: What's Actually Different?
Because JSX is JavaScript, and class is a reserved word. JSX uses className for the HTML class attribute to avoid the conflict. The same logic applies to htmlFor instead of for.
In HTML, style is a string. In JSX, style takes an object with camelCased keys like backgroundColor and fontSize, not kebab-case strings, because JSX maps attributes to DOM properties.
Yes. Every tag must be closed, either with a closing tag or as a self-closing tag with a slash. Tags like br and img that are unclosed in HTML still need the closing slash in JSX.
Still have questions?
Browse all our FAQs or reach out to our support team
