~/alexsh.blog

$ cat react-internals/01-the-pipeline.md

The Pipeline

February 9, 20261 min readpart 01/13

When you write <App />, a chain of transformations runs before pixels reach the screen. Understanding this full pipeline is the key to understanding React.

diagramtext
JSX → React.createElement() → React Element (plain object)
    → Reconciler (Fiber) → Commit → DOM → Browser Paint

JSX is not HTML. Babel (or SWC/esbuild) transforms it into React.createElement() calls — or the newer jsx() runtime from React 17. The result is a plain JavaScript object:

codetsx
// What you write:
<div className="app">
  <Header title="Hello" />
</div>

// What it becomes:
{
  $$typeof: Symbol(react.element),  // Security: prevents JSON injection
  type: 'div',
  props: {
    className: 'app',
    children: {
      $$typeof: Symbol(react.element),
      type: Header,    // Reference to the function
      props: { title: 'Hello' },
    }
  },
}

The $$typeof: Symbol(react.element) field is a security measure. Since Symbols can't be serialized to JSON, a server can't be tricked into returning a malicious element from user input.

Further reading