DEV Community

Discussion on: Easily fetch data: react-api-hook

Collapse
pavermakov profile image
Pavel Ermakov

Can you run multiple requests in parallel? Can you chain one request to another?

Thread Thread
demicdev profile image
Michele Author

If you have to run multiple request, you only have to declare another hook:

const [stateFirst, sendFirst, cancelFirst] = useAPIHook(ENDPOINT1, configFirst);
const [stateSecond, sendSecond, cancelSecond] = useAPIHook(ENDPOINT2, configSecond);
Enter fullscreen mode Exit fullscreen mode