scrimba
Note at 2:50
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

Note at 2:50
AboutCommentsNotes
Note at 2:50
Expand for more info
Joke.js
run
preview
console
import React from "react"

export default function Joke(props) {
const [isShown, setIsShown] = React.useState(false)
/**
* Challenge:
* - Only display the punchline paragraph if `isShown` is true
*/
function toggleShown(){
setIsShown(prevShown => !prevShown)
}
return (
<div>
{props.setup && <h3>{props.setup}</h3>}
{isShown && <p>{props.punchline}</p>}
<button onClick={toggleShown}>Show Punchline</button>
<hr />
</div>
)
}
Console
/index.html
LIVE