Comment

Comment by nop_slide

Interesting, I mostly followed this approach which is to basically never use those constructs unless you are 100% certain you know what will happen.

https://kentcdodds.com/blog/usememo-and-usecallback

TLDR;

> Specifically the cost for useCallback and useMemo are that you make the code more complex for your co-workers, you could make a mistake in the dependencies array, and you're potentially making performance worse by invoking the built-in hooks and preventing dependencies and memoized values from being garbage collected. Those are all fine costs to incur if you get the performance benefits necessary, but it's best to measure first.

parent nop_slide 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton