← React Beginner Questions - Set 6 Q54
React Beginner Questions - Set 6
JSX is the authoring format; `createElement` is what it compiles to. Same result, different ergonomics.
// JSX
const card = (
<article className="card">
<h3>Title</h3>
</article>
);
// Compiled, with the automatic runtime
import { jsx as _jsx } from 'react/jsx-runtime';
const card2 = _jsx('article', {
className: 'card',
children: _jsx('h3', { children: 'Title' }),
});
// The classic runtime calls React.createElement directly
const card3 = React.createElement('article', { className: 'card' },
React.createElement('h3', null, 'Title'));