Austin Malerba
1 min readMay 22, 2019

--

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

--

--

Austin Malerba
Austin Malerba

No responses yet