Hey Matthias, thanks and good question! I’d recommend having another custom hook to wrap the client that interacts with your remote API. So for example if you were interacting with the Spotify API, then you would have another hook called
useSpotifyApi which would in turn consume
useSpotifyStore. But going back to the Todos example, a solution might look like this.
Here’s a working example: https://codesandbox.io/s/todos-async-useapi-qpf2o