Earlier quoted context omitted.
The problem isn't using axios, it's making sure your React components interact with axios appropriately. You will want the request to (1) fire when the component mounts, (2) cancel if it's going to unmount, and (3) re-render with the result/error once the request is finished. This is a pattern you will do over and over again. This gets really messy when one component needs to be able to make two or three different ca…
And that is sort of solving a language verbosity problem with classes and inheritance and the fact that to mixin behaviors classically one would use inheritance but it doesnt compose well and had problems passing things up to different constructors. Functions work better if you can call them because you can more easily select and add them ala carte and pass individual different specific parameters to each one whereas…
Use Hooks – A Collection of Reusable React Hooks
31–34 of 34 posts
Re: Use Hooks – A Collection of Reusable React Hooks
#32Earlier quoted context omitted.
The problem isn't using axios, it's making sure your React components interact with axios appropriately. You will want the request to (1) fire when the component mounts, (2) cancel if it's going to unmount, and (3) re-render with the result/error once the request is finished. This is a pattern you will do over and over again. This gets really messy when one component needs to be able to make two or three different ca…
And that is sort of solving a language verbosity problem with classes and inheritance and the fact that to mixin behaviors classically one would use inheritance but it doesnt compose well and had problems passing things up to different constructors. Functions work better if you can call them because you can more easily select and add them ala carte and pass individual different specific parameters to each one whereas…
Re: Use Hooks – A Collection of Reusable React Hooks
#33Earlier quoted context omitted.
The hooks docs are complete garbage. They don't explain anything properly and they use dumbed down language that ambiguates important details, in an attempt to make them more "accessible" to beginners (that somehow are too stupid to understand classes but can magically grasp these far more advanced concepts?). Dan's blog post is much better, in comparison. Start with that maybe.
If you think the docs can be improved, please submit PRs: https://github.com/reactjs/reactjs.org