Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It will sound like “you’re holding it wrong” argument. But most issues I heard about hooks is when people don’t isolate their React UI modules from other modules in the application. Instead they use the library/platform api directly in their components which is guaranteed to be a mess. Hooks are way to integrate your UI with the rest of the world, not to manage it. Things like using web sockets, playing audio, etc, should be in external modules which you connect to with hooks, and those modules should be designed with React lifecycle and state in mind. An example is react-query, which does a great job of adapting “fetching from an API” use case to the react world.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: