react-hooks/exhaustive-deps issue
ESLint want's me to put that dependency but doing so will cause an infinite loop to rerender
11 Replies
anyone knows how to solve this issue? thanks in advance!
Why are You using memo here? It's for values. I guess you're looking for useEffect
But useEffect will have the same warning, right?
Yes, but you can just include it in the array - it's guaranteed to never change so it won't cause it to rerun
In general you should be avoiding useEffect all together
It might be a better idea to do this length check in handleNameQuery and fetch from there
okay this works
thanks!
what about this one i got from tanstack table example?
Debounce and onChange won’t change normally, so including them to the dependency array should work if I‘m correct
yeah, should be fine
i prefer useDebounce from react-use but both will achieve the same