DEV Community

Discussion on: Create a Modern Dynamic Sidebar Menu in React Using Recursion

Collapse
woeps profile image
Christoph Wanasek

You could extend the SidebarItem component with a prop show: bool = true value, which toggles the rendering.
Then you just wire up the onClick of the "parent ListItem" to toggle the prop of it's "child ListItem".

Collapse
edenjamal profile image
Jamal Eden

Thanks a lot.