React tip: Context can enhance performance too
React tip: Context can enhance performance too.
Example: Have a component that needs some data, but some of its parents don't need that data? Consider using context. Then those parent components won't re-render when that data changes.
I just used this approach to avoid 100's of rows needlessly re-rendering. The rows were re-rendering just because some data they were passing down changed. By connecting the child to context, the parent no longer re-renders. It doesn't even receive that data on props anymore. 😎