3 ms·
> I can put that in a useMemo and it won't sort it again when the page eventually rerenders for some reason useMemo dependency smell. This is almost always bec
by Our_Benefactors 1y ago
> I can put that in a useMemo and it won't sort it again when the page eventually rerenders for some reason
useMemo dependency smell. This is almost always because your dependencies are wrong. This can often happen if you put a dependency as [object] instead of [object.field] due to how JavaScript maps objects to memory.
- skydhash 1y agouseMemo is quite nice when you're doing data transformation against some API call or other big data structure.
- Our_Benefactors 1y agoYes, it is, but you still have to declare your dependencies correctly.
- adithyassekhar 1y agoNever thought of it that way. What if it's an array though, how will I put it as a dependency?