scrimba
Advanced React
Reusability
Menu onClose event
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

Menu onClose event
AboutCommentsNotes
Menu onClose event
Expand for more info
index.js
run
preview
console
import React from 'react';
import ReactDOM from 'react-dom/client';
import Menu from "./components/Menu/index"
import Star from "./components/Star"

function App() {
return (
<>
<Star onChange={() => {}} />

<br />

<Menu>
<Menu.Button>Menu</Menu.Button>
<Menu.Dropdown>
<Menu.Item>Home</Menu.Item>
<Menu.Item>About</Menu.Item>
<Menu.Item>Contact</Menu.Item>
<Menu.Item>Blog</Menu.Item>
</Menu.Dropdown>
</Menu>
</>
)
}

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
Console
!
TypeError: onToggle is not a function
,
!
"The above error occurred in the <Toggle> component: at Toggle (https://cw1.scrimba.com/components/Toggle/Toggle:3:34) at Menu (https://cw1.scrimba.com/components/Menu/Menu:3:32) at App Consider adding an error boundary to your tree to customize error handling behavior. Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries."
,
!
TypeError: onToggle is not a function
,
/index.html
-1:59