You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The profiler shows us that each time the app re-renders, all of the list items re-render. This is because the list items are inline function components that get recreated each time your app renders:
This means that React will see them as a new type each time it renders, and so it will re-render them too.
Try moving the list item renders outside of your App render method, like so:
Now let's use the profiler to look at this forked sandbox where I did just that:
The profiler shows us now that only your App component is re-rendering when you call forceUpdate()
Maybe I should update the docs to avoid showing inline render methods. I tried to keep the docs brief so that they could be read easily but I can see how they might be misleading currently.
Is it expected behaviour?
https://codesandbox.io/s/521oq1v574
The text was updated successfully, but these errors were encountered: