forked from BolajiOlajide/a_socials
-
Notifications
You must be signed in to change notification settings - Fork 7
REACT Best Practices setState
Patrick Alvin Luwum edited this page Jun 20, 2018
·
1 revision
Manage the application state using redux store when it is in global state. Avoid using setState in your component when you are using state management libraries like redux. Use component state when it makes sense ie. A Button component that shows a tooltip when hovered would not use Redux.
Avoid Doing this.
Instead do this
Here we used the redux store to get state and render it in the view directly. There is no need of using setState and component lifecycle hooks again. Redux is there to do the state management job for you.