currently I am struggeling with React Router & ZustandJS.
I like to use a Store to save a part of the path of the current location. Like Test/Test123/. And and as soon Test123 will change to Test124 useEffect should fire an action(fetch) which is gonna update the store after success. But with the current Code it triggers twice. Even if the value will be same as before. I guess its because react router remounts the Compontent. How to handle this issue without using useRef to the previous value?
https://codesandbox.io/p/sandbox/zustand-router-problem-double-render-27q4t2
I tried already to fix it with use ref and surely it will work. But this would mean I have to check all the time the previous variable…