Performance: What is JSX
JSX affects the initial JavaScript bundle size and parsing time, impacting page load speed and rendering start.
const element = <div>Hello World</div>;const element = React.createElement('div', null, 'Hello World');
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| JSX syntax | No direct DOM ops at runtime | 0 reflows from JSX itself | No paint cost from JSX | [OK] Good |
| React.createElement calls manually | No direct DOM ops at runtime | 0 reflows | No paint cost | [OK] |
const element = <h1>Hello, {"React"} & JSX!</h1>;
ReactDOM.render(element, document.getElementById('root'));const element = <div>Hello {name}</div>
ReactDOM.render(element, document.getElementById('root'));
Assuming name is not defined anywhere.The sum is {2 + 3}
correctly uses curly braces with 2 + 3, which evaluates to 5. Options A and B treat it as a string, and C uses parentheses without curly braces, so it won't evaluate.Pass the test and this pattern moves unknown