You get a bonus - 1 coin for daily activity. Now you have 1 coin

How do you make conditionally rendered components? in REACT

Practice



In some cases you want to render different components depending on state. JSX does not render

false
or
undefined
, so you can use conditional short-circuiting to render a given part of your component only if a certain condition is met.
const MyComponent = ({ name, address }) => (
  <div>
    <h2>{name}</h2>
    {address &&
      <p>{address}</p>
    }
  </div>
)
If you need an if-else 
condition, use the ternary operator .

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone