Capítulo 81 de 116
createElement(type, props, ...children) is the plain-JavaScript function JSX compiles down to — every <Component prop={x}>child</Component> you write becomes a createElement call under the hood, callable directly when writing React without JSX at all.
createElement(type, props, ...children) — type is a string ('div') for a host element or a component reference for a custom one; props is the props object (or null); remaining arguments become children.<Greeting name="Ada" /> compiles to createElement(Greeting, { name: 'Ada' }) — understanding this equivalence explains why JSX has the constraints it does (e.g. why a capitalized tag name resolves to a variable reference, not a string).createElement manually is mainly relevant for tooling that generates React trees programmatically without a JSX transform step, or for understanding what a JSX expression actually produces.// These two are equivalent:
const a = <Greeting name="Ada" />;
const b = createElement(Greeting, { name: 'Ada' });
createElement is the runtime call, JSX is the readable syntax that compiles to it.createElement (or an equivalent JSX-runtime) call — there's no separate "JSX engine" at runtime.