by pcr910303 · 6y ago · 0 comments
The only recommendation I got is to use React.memo, which still rerenders every element, but from some internal cache.
For class components in react you also have a special method shouldComponentUpdate that you can write to optimize things. But I feel we are into performance details now, it doesn't make the code hard to understand. You updated a value in the context and some component re-renderd, hopefully with the correct output.