--

Hi Ala

Thanks for your thoughts! I don't 100% agree. Sometimes the logic inside of the effect is also quite long and might not be relevant for someone who takes a look at the component.

Then it definitely makes sense to put the effect into a custom hook. The positive advantage of the custom hook is that you can give it a declarative name which makes your component more readable.

--

--

Lorenz Hofmann-Wellenhof
Lorenz Hofmann-Wellenhof

Written by Lorenz Hofmann-Wellenhof

👨‍💻 Software Eng @ AI unicorn 🇺🇸 Sharing my lessons for non-stop growth in AI, coding, & life optimizations. I build things & put them on the Internet.

Responses (1)