Why use JSX when you can use template literals?
Let’s look at some simple examples from the React documentation. You’ll have to forgive the syntax highlighting in the JSX snippets; I refuse to add more CSS just to highlight a redundant pseudo-language.
Inserting a variable
Inserting a function call
Do you see my point?
I literally cannot see how JSX is any better than template literals.
- Template literals are native. They don’t require you to add a syntax highlighting extension to your editor.
- You can combine template literals with a smaller library like Reef. You don’t have to give up reactive, state-based components.
If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!