|
|
|
|
|
by MobiusHorizons
1071 days ago
|
|
react didn't invent that syntax. This is a standard piece of C like syntax that most (but not all) languages with curly braces share. JSX/TSX used in react don't make this choice for you, you can use any javascript syntax which can be used when passing a value (eg in a function invocation, or variable declaration). If you don't like it, you are perfectly free to declare a variable and set its value using a regular if / else block and use it directly from the template. My point is this is not a syntax decision that React made, but svelte's syntax was (as far as I can tell) a decision. |
|