DEV Community

Discussion on: Explain JSX like I'm five.

Collapse
 
matijanovosel profile image
Matija Novosel • Edited

JSX is a combination of HTML and Javascript to put it simply, or as the official React site says: "a syntax extension of Javascript". It offers the functionality of writing Javascript expressions inside HTML elements which is then processed to create the UI.

e.g. this...

const navBar = (<nav className="bg-yellow"> Home </nav>);
Enter fullscreen mode Exit fullscreen mode

... gets converted into:

const navBar = React.createElement("nav", { className: "bg-yellow" },  "Home");
Enter fullscreen mode Exit fullscreen mode
Collapse
 
hr21don profile image
Helitha Rupasinghe

Thank you for sharing!