Ask HN: What are the best practices to apply in large react-hooks code base? - sriram_iyengar
======
nip
\- refrain from using hooks everywhere, instead, prefer using them in «
container » type of components to separate the hard logic from the soft one
(cosmetic logic, such as color changes, hiding / showing parts of the UI)

\- Hook-based context is a godsend, but similarly, should be used only when
needed (to provide deeply nested components with specific props): passing
props around is not a bad thing and makes you think more of your architecture
(going through the pain of passing props down might be painful and makes you
reflect on the choices you made when designing a specific part of the app).

\- Folder structure

These rules are not about performance (modern frameworks deal with that
equally well: the user code is the culprit and there’s no one-size-fits-all
advice to improve that), but rather to keep your sanity. It will also help
when writing tests as they will be nicely siloed.

~~~
sriram_iyengar
Thanks that is useful.

