Test Flashcards
1
Q
Test
A
<pre><code>If–else statements cannot be used inside JSX but ternary expressions instead. In example below browser will render "true" because i is equal to 1.
import * as React from 'react';
~~~
class App extends React.Component {
render() {
var i = 1;
return (
<div>
<h1>{ i === 1 ? 'true' : 'false' }</h1>
</div>
);
}
}
~~~
export default App;</code></pre>