DEV Community

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

 
demicdev profile image
Michele

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