Code Editor
Intro to JSX

JSX Elements And Their Surroundings

JSX elements are treated as JavaScript expressions. They can go anywhere that JavaScript expressions can go.

That means that a JSX element can be saved in a variable, passed to a function, stored in an object or name it.

Here's an example of a JSX element being saved in a variable:

const navBar = <nav>I am a nav bar</nav>;

Here's an example of several JSX elements being stored in an object:

const myTeam = { center: <li>Benzo Walli</li>, powerForward: <li>Rasha Loa</li>, smallForward: <li>Tayshaun Dasmoto</li>, shootingGuard: <li>Colmar Cumberbatch</li>, pointGuard: <li>Femi Billon</li> };
Report a Bug
If you see a bug or any other issue with this page, please report it here.