JSX is syntax, not a React feature. A compiler (Babel, esbuild, SWC, TypeScript) turns every tag into a function call before the code runs.
The automatic runtime, required since React 19, adds the import itself and compiles <Greeting key="g1" name="Ada" /> to jsx(Greeting, { name: "Ada" }, "g1"):
typeis a string for host tags ("h1") or the component itself for capitalised tags. That's why<greeting />means a DOM tag calledgreeting.- Children go inside
propsasprops.children. Several static children usejsxs, which tells React the array is fixed so it skips the missing-keywarning. keyis a separate third argument; it never reachesprops.refis an ordinary prop in React 19.- Development builds call
jsxDEVfromreact/jsx-dev-runtime, which adds the source location and a few checks.
The classic transform compiled to React.createElement(type, props, ...children). createElement still exists for code written without JSX.
A React element is the return value: a plain object describing what to render.
$$typeof:Symbol.for('react.transitional.element')in React 19. React renders only objects carrying this tag. A JSON payload can't contain a symbol, so injected data can't pose as an element.type,key(a string ornull), andprops.
Creating an element is cheap and does nothing else: the component isn't called and no DOM exists yet. React calls Greeting later, during rendering, when it reaches that element in the tree, then compares the elements it returns with the previous ones.
Elements are immutable snapshots. In development React freezes each element and its props shallowly; production builds skip the freeze for speed, so mutation goes unnoticed there. To change the UI, render again and return new elements.