scrimba
Frontend Career Path
Advanced React
Reusability
Custom Hooks - useToggle part 5
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

Custom Hooks - useToggle part 5
AboutCommentsNotes
Custom Hooks - useToggle part 5
Expand for more info
components
Menu
Menu.js
run
preview
console
import React from "react"
import useToggle from "../../hooks/useToggle"

/**
* Challenge:
* 3. Create context (MenuContext). Make sure to export
* it so we can access it in the other Menu components!
* (Will be a named export, not default export).
* 4. Wrap the div below with the context provider
* 5. What do you think we should pass as the values
* to the provider? 🤔
*/

export default function Menu({ children, onOpen }) {
const [open, toggleOpen] = useToggle()

return (
<div className="menu">
{children}
</div>
)
}
Console
/index.html
-3:05