Is it safe to omit variables from other hooks (e.g. useContext and useNavigate) from the dependencies of useMemo?

Viewed 19

If I do omit that, I get an eslint warning. But if this would be a problem, because they'd chage in consecutive renders than the render code in useMemo would run on each render.

Fortunately this is not the case currently, but this may change isn't it?

So what is the best practice? Do the correction and put them in the deps, or ignore the warning by knowing it is safe forever?

0 Answers
Related