DEV Community

Discussion on: Explain JSX like I'm five.

Collapse
 
posandu profile image
Posandu • Edited

JSX is just fancy HTML (With some rules) that compiles to pure JavaScript. So if you write something like this:

 <div>
    <h1>Hello World</h1>
 </div>
Enter fullscreen mode Exit fullscreen mode

It will compile to something like this:

React.createElement("div", null, React.createElement("h1", null, "Hello World"));
Enter fullscreen mode Exit fullscreen mode

So now you can generate HTML with JavaScript. This is the basic idea behind JSX.

Collapse
 
hr21don profile image
Helitha Rupasinghe

Great example! πŸ‘

Collapse
 
codesimple profile image
code-simple

πŸ‘Welldone