clearMapRefinement as dependency in useEffect is causing loop #6521
Unanswered
martinsnajdr
asked this question in
Q&A
Replies: 1 comment
-
Not sure I've seen this issue before, but it's possible that clearMapRefinement isn't a stable function, however it should behave just the same at first rendering as later, so you can safely memo it and or use just the first / old reference. If you have a repro of this, we could look into the cause |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm watching a ref value using useEffect and in this useEffect I use
clearMapRefinement
function (fromuseGeoSearch
) to reset the map refinement if the ref value is false. I'm adding both ref value and clearMapRefinement into useEffect dependency array to prevent eslint errorreact-hooks/exhaustive-deps
. But adding clearMapRefinement into dependency array causes some kind of useEffect loop (the useEffect is called many times).Any idea for a solution?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions