Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React Context API!
You have completed React Context API!
Preview
Now that context is set and the provider is in place, we'll provide state to the entire app. We'll set up Consumers that subscribe (or connect) to the Provider component to make use of the context.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The provider usually lives at the top
level of your app, and that's what's going
0:00
to provide the actual data that needs to
be shared throughout the component tree.
0:01
The provider component requires
a value prop to share data.
0:07
The value can be anything, but
it's usually the application state and
0:12
any actions or
event handlers shared between components.
0:17
Let's pass the provider's
value prop an object.
0:22
Inside the object, we'll pass in
our data with a set of properties.
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up