DEV Community

Discussion on: Fast track your React learning with these 12 Tips!

Collapse
 
stereoplegic profile image
Mike Bybee • Edited

3) Forget about Redux, Context API, and other fancy State Management Things

One of these things is not like the others. While sophisticated "State Management Things" can be built on top of the Context API, Context itself is not that difficult to pick up, and reinforces learning of both components and hooks in the process.

React has it's own state management features, which are easier to understand and more than enough to get you going in the beginning.

Context isn't just for this (it need not ever change), but it can be a vital part of "[React]'s own state management features" and getting to know it earlier on can make even local state management of combined components easier. Either way, it's an important tool to have in one's toolbox for the avoidance of prop drilling Hell.

  • When a components state changes, React will re-render the component
  • When a component rerenders, it will automatically re-render its children

This applies to Context providers as well, making them a great way to reinforce this knowledge.

With all of that said, it is important to note that multiple, localized contexts can and should be used, when used for any state which is bound to change frequently.

Collapse
 
thefern profile image
Fernando B 🚀

I agree I just learned context and I'm brand new to React I think is a nice to have in the beginning to avoid super deep props passing down. If you come from other languages Context is like using Delegates with a publisher/subscriber methodology. One component publishes data, the subscribers consume it without the need for props passing.