Simplify Passing State In React With The useContext Hook - React Hooks 101 Part 5 of 6
We've now arrived at Day 5 of our special 6-part YouTube tutorial series on React Hooks . Hooks are so important for all React developers to understand because, conceptually, React components have always been closer to functions and the library supports a functional way of thinking. Hooks add powerful capabilities to functional components. Now in Tutorial 5, Paige covers a powerful Hook - the useContext Hook: The use of component hierarchies solved problems in React around composing UI out of smaller individual parts, but created a range of new problems: More importantly, passing props down became unwieldy in complex component hierarchies where the intermediate components did not need props that were intended for a component further down the hierarchy. These problems are neatly solved for us using the Context API in React, and the useContext Hook lets you share state easily in component hierarchies without passing props down. Learn all about the useContext Hook and how to use it in today's React Hooks tutorial. Keep an eye out for the 6th and final tutorial in our React Hooks series. In it, we'll go in-depth into Custom Hooks and how to write your own. Mastering this skill will turn you into a much more versatile React dev.