Creating a simple strongly-typed context for function components
In this lesson, we will learn what context is and discover how TypeScript can infer the type for it.
Understanding React context #
React context allows several components in a tree to share some data. It’s more convenient than passing the data via props down the component tree.
The context is provided at a point in the component tree, and then all the children of the provider can access the context if they wish.
Get hands-on with 1400+ tech skills courses.