Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tab switch re-render the page on every switch #2062
I am using Tab component of email@example.com, When I am switching the tab, it is calling render method of the component containing the tab. Ex-
switching from test1 to test2 it calls the test1 render function first and then test2. This happens twice. Is it correct ? Why on tab switch the render function is getting called if there is no state change ?
it is correct. the tab state changes when you switch tabs and so rerenders (to hide one tab and show the other). React works by rerendering entire trees so you inner components also rerender. This is really normal in React, rerenders happen all the time, which is fine because they are very cheap since react only changes the DOM when your component actually changes