Pradeep K. Pant Blog

 

JSX in ReactJS: a quick intro with examples

What is JSX file 

More JSX

Examples:

HTML inside JSX -> output: 2 + 3 import React from 'react'; import ReactDOM from 'react-dom'; ReactDOM.render(<h1>2 + 3</h1>,document.getElementById('app'));

JS inside JSX-> output: 5
import React from 'react';     import ReactDOM from 'react-dom';     ReactDOM.render(<h1>{2 + 3}</h1>,document.getElementById('app'));

More about JSX and React on my next post.

Keep learning!



 

 

Copyright © 2007-2024 PRADEEP K. PANT

Source Code | RSS