How does JSX work? code example
Example 1: jsx react
const element = <h1>Hello World</h1>
Example 2: javascript in jsx
const name = 'Josh Perez';
const element = <h1>Hello, {name}</h1>;
//notice the use of {...} to jump from jsx to javascript.
ReactDOM.render(
element,
document.getElementById('root')
);
Example 3: what is jsx
// JSX is an extension of JavaScript XML.
// Example
const element = <h1>Hello, world!</h1>;