DEV Community

Discussion on: 14 Beneficial Tips to Write Cleaner Code in React Apps

Collapse
 
dance2die profile image
Sung M. Kim

Thank you for the great post as usual.

I agree with 10. Use useReducer if useState becomes complex not just because you can co-locate concerns but also because you can extract that functionality out as you mentioned in 6. Put Independent Functions Outside of Your Custom Hooks.

I had to create a context (using tips on How to use React Context effectively) and had very easy time make it into a context value.