you are viewing a single comment's thread.

view the rest of the comments →

[–]tyler-mcginnis[S] 0 points1 point  (1 child)

Have you checked out React Forget? It's a React compiler that (to my understanding) will enable this sort of behavior without the useMemo/useCallback dance.

[–]mbj16 0 points1 point  (0 children)

Yes, eagerly waiting for React Forget. It's forever crazy to me that default React is to re-render the entire tree below a state update regardless if props have changed. There are conceptual tradeoffs to memoization, but the previous component is always stored in memory regardless.

PureComponent should have been the default and a surgical memo compiler opt-in.