When I use a react functional component with some state manager (I\'m using recoil.js) and I try to update the state with a react hook it only calls useEffect when the state