trendmicro-frontend / react-sidenav

React SideNav component
https://trendmicro-frontend.github.io/react-sidenav/
MIT License
349 stars 105 forks source link

How to prevent child components from re render when toggling sidenav? #53

Open lausellduane opened 4 years ago

lausellduane commented 4 years ago

Every time I click the toggle button the child components re-render, how do I stop that from happening? I have a component that calls an api which populates a table when the user clicks a search button. When the table is populated and you click the toggle button it would re render the table, that should not happen as I am not navigating away from it. I already tried checking the collapse property on the nav inside shouldComponentUpdate so it return true when they are different but then the sidenav won't expand. I have tried sending the state to history.push but I got an error I don't really understand how it works. Please help this component is very good but It would be unusable for me just because of this re rendering issue.