2

I'm learning react and I was trying to find a way to loop inside JSX when I came across this stackoverflow link - Loop inside React JSX The author of the question says that I realize and understand why this isn't valid JSX, since JSX maps to function calls I don't understand what he meant.

1 Answers1

4

It means that ...

<MyButton color="blue" shadowSize={2}>
  Click Me
</MyButton>

... compiles to the function call:

React.createElement(
  MyButton,
  {color: 'blue', shadowSize: 2},
  'Click Me'
)

... as described here: https://reactjs.org/docs/jsx-in-depth.html

Andre Pena
  • 56,650
  • 48
  • 196
  • 243