DEV Community

Hooked on React hooks

Markus Claus on March 17, 2019

Whenever I read about a new feature in React, I'm all over it. I try to understand what's going on and how I could apply this new feature to my pro...
Collapse
 
pigozzifr profile image
Francesco Pigozzi

Great article!

Your explainations are clear and accessible.

I probably found a typo in your custom hook useFetchData inside the useEffect deps. You wrote [props.id] but maybe you meant to write [url] or something like this.

Cheers! 🦄

Collapse
 
markusclaus profile image
Markus Claus

You are correct. That was a copy and paste error. I missed that.

Thank you 😊

Collapse
 
httpjunkie profile image
Eric Bishard

Best kind of errors! IMHO..

Collapse
 
dimensi0n profile image
Erwan ROUSSEL

Thanks for this article 💪 I understand now how to use react hooks 🙃

Collapse
 
guico33 profile image
guico33

Your useFetchData example is wrong. Look at the function signature and how you call it.

Collapse
 
markusclaus profile image
Markus Claus

True, late night posting.. Never a good idea. Fixed it, thanks.

Collapse
 
motss profile image
Rong Sen Ng • Edited

Can we actually make multiple fetches with Promise.all inside an useEffect hook?

Collapse
 
httpjunkie profile image
Eric Bishard

I'm not sure the exact question here. But Hooks have a clear set of rules to follow. As well 'useEffect' can be used several times so you that you cad can properly group related code and seperate it from unrelated code. Co-location of your effects