๐ Whenever I see useCallback, I wonder: why do we need it here? And a lot of the times, when I look deeper, I see that it actually doesnโt do anything. I think a lot of code-bases would be better of just not memoizing at all - and then let the compiler do it for you:
Post
tkdodo.euThe Useless useCallbackWhy most memoization is downright useless...
Yeah that's a bit of a non-trivial situating. Adding props to dependency arrays is adding component coupling. IMO it breaks encapsulation, and to me is a bit of a smell that warrants extra attention. Not to say that it's wrong, just not trivial. no such thing as a free lunch, and all that
0 reposts1 like