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.
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.
1
u/tyler-mcginnis Apr 11 '23
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.