scrimba
Frontend Career Path
React basics
Meme generator
Conditional rendering: &&
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Conditional rendering: &&
Expand for more info
Joke.js
run
preview
console
import React from "react"

export default function Joke(props) {
/**
* Challenge:
* - Create state `isShown` (boolean, default to `false`)
* - Add a button that toggles the value back and forth
*/
return (
<div>
{props.setup && <h3>{props.setup}</h3>}
<p>{props.punchline}</p>
<hr />
</div>
)
}
Console
/index.html
-6:36