DEV Community

Discussion on: 5 Good practices to scale your React projects easily

Collapse
 
dikamilo profile image
dikamilo

Always start with state management

I will add here: abstract here from your current state management tool. Create custom hooks that will provide data. It will be easy to change from for example React providers to Redux when needed just by replacing logic in custom hooks and not refactor every component.

Collapse
 
agnel profile image
Agnel Waghela

Hi, @dikamilo, can provide an example? I would like to get a clear idea through it.

Thanks.

Collapse
 
jeffreythecoder profile image
Jeffrey Yu

Great advice! It's clean to wrap hooks like useSelector, useEffect and useMemo in a custom hook and not in the component.