scrimba
Learn React
Meme generator
Challenge: flipping state back and forth
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

Challenge: flipping state back and forth
AboutCommentsNotes
Challenge: flipping state back and forth
Expand for more info
App.js
run
preview
console
import React from "react"

export default function App() {
/**
* Challenge:
* - Initialize state for `isGoingOut` as a boolean
* - Make it so clicking the div.state--value flips that
* boolean value (true -> false, false -> true)
* - Display "Yes" if `isGoingOut` is `true`, "No" otherwise
*/

return (
<div className="state">
<h1 className="state--title">Do I feel like going out tonight?</h1>
<div className="state--value">
<h1>Yes</h1>
</div>
</div>
)
}
Console
/index.html
-5:59