I'm not sure if wrapping intermediary callbacks and non-primitive variables in a memo is best practice, but it's definitely one solution.
It's worth noting the memory used is going to be in-browser memory. In my experience, the usage from all the useCallback/useMemo/useEffect dependencies arrays is not noticeable even at scale. See here for more info about the potential future compiler.
0
u/[deleted] Mar 30 '22
[deleted]