How it works...
In step 4, we created the render function for the main App component. We stored the Menu component in a menu variable so that it can be legibly passed to the menu property of SideMenu, as we did in step 5. We pass the changeBackgroundColor class method via the onColorSelected prop on our Menu component so that we can use it to properly update state in the App component.
We then pass the Menu component to SideMenu as the menu prop, which wires the two components together. The second props is isOpen, which dictates whether the side menu should be open. The third prop, onChange, takes a callback function that's executed every time the menu is opened or closed. The onChange callback is provided an isOpen parameter that we used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access