Embedding Expressions
JSX allows you to embed expressions between tags by surrounding the expressions with curly braces ({ }
).
1 2 3 | var a = <div> {[ "foo" , "bar" ].map(i => <span>{i / 2}</span>)} </div> |
The above code will result in an error since you cannot divide a string by a number. The output, when using the preserve
option, looks like:
1 2 3 | var a = <div> {[ "foo" , "bar" ].map( function (i) { return <span>{i / 2}</span>; })} </div> |
Please login to continue.