Valeri Karpov on how JSX is transformed into JavaScript:
The JSX compiler parses all the element types, props, and children, and passes each of the nodes in the tree through a pragma. The pragma is just a fancy term for the function that JSX calls on each node. In the case of React,
React.createElement
is the pragma. But you can configure the pragma using an/** @jsx */
comment
Diverging from React he highlights how you use different pragmas to:
- Build a Tree
- Define Express Route Definitions
- Define Mongoose Schema Definitions
An Overview of JSX With 3 Non-React Examples →
💡 The post What is JSX pragma? might come in handy to demystify React’s React.createElement
pragma.