Sep 3, 2022
The big problem I see here is that you're always calling setData when getData returns, as if it's impossible for an earlier call to return back after a later call, and as if your component will never unmount. I think you should think a bit more on your mental model.