An Overview of JSX With 3 Non-React Examples

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.

About the Author

Bramus is a Freelance Web Developer from Belgium. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.