What are some terms you found confusing when learning web development and/or React? No judgement, please send me some!
You can’t put just any code there. Only a single expression. Try e.g. <MyComponent someProp={ var foo = 4 }>
-
-
You can put multiple lines of code, declare variables, even write a for loop. Doesn’t have to return anything. I saw it in a Jr Dev’s code the other day. It technically worked. Maybe using a single var declaration doesn’t.
-
If it worked then it was inside a function literal. e.g.: () => { var foo = 4 } A function literal is also an expression, though the code inside it, “unwrapped”, isn’t. Also, if it doesn’t return anything there’s no use putting it in the JSX :)
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.

