You're updating state, that your effect hook depends on, within the hook. So every time the state is updated the effect is run, which updates states which runs the effect etc.
You should use something like react query to handle async data
A community for discussing anything related to the React UI framework and it's ecosystem.
Icon base by Skoll under CC BY 3.0 with modifications to add a gradient
You're updating state, that your effect hook depends on, within the hook. So every time the state is updated the effect is run, which updates states which runs the effect etc.
You should use something like react query to handle async data
I think the only thing that should be in the dependency array of the useEffect is jsonParams.
I've only ever used hooks with no dependencies to effectively "run once" so I don't know how to make them fire conditionally, but you definitely don't want the state variables in there.
Sometimes you do want state variables in the dep array. Not super often but it does happen.
And you shouldn't just always use an empty array. That creates fragile components. Even for effects that you want to just run once. Always follow the eslint rule