score:2

Accepted answer

according to the comments section, sidenav is a child of app component. so therefore, just pass down the state and state setter to sidenav and from there, when an item is clicked, just set menuopen to false or simply negate the state.

const app = (props) => {
    return(
        ...
        <sidenav menuopen={menuopen} setmenuopen={setmenuopen }/>
    )
}

on sidenav:

<item to="/product-category/top/t-shirt" onclick={()=>{props.setmenuopen(!props.menuopen)}}> t - shirts </item>

Related Query

More Query from same tag