News for hackers. Stuff that matters.
Re:Use Hooks – A Collection of Reusable React Hooks by exogen on Thursday December 13, 2018 @10:27PM (#18678203)
Reusability, which software folks generally consider to be a good thing.

Let's say you used Axios directly in your components. That means every component needs to (1) set up its own state to track the request status (like whether it's loading, errored, the latest payload, etc.) and (2) set up its lifecycle hooks to kick off the request at the appropriate times, update the component's state, etc.

Do this a few times and you'll notice things becoming very repetitive. So naturally you look for a way to factor that out.

A higher-order component (basically a function that generates a component with all that boilerplate) is one option. Another option is what you see here – Hooks.

Re:Use Hooks – A Collection of Reusable React Hooks by duncan-donuts on Thursday December 13, 2018 @10:45PM (#18678304)
Yeah I’ve dealt with the repetition and boilerplate, but maybe I’m not working in react apps of significant size. I should really revisit hooks and understand them better.