In this video.
Let's see how we can consume the data from the context API file.
So here we go.
And this is where we left in the previous video.
So now we need to locate the component where we want to have access to the state and the function from
this file.
So we are going to implement what is called low gain functionality.
So let's go to the login page and inside components and then forms and then the log in component.
And here we are.
The next step is that to be able to consume contacts, we need to use a hook called use context.
The name is even descriptive.
We are going to use a context and I have imported it as that.
All right.
So here we go.
We are going to call the use context inside the component and start as a function call.
And this one requires only one element, and that is an instance of create contexts.
And for us we have it already inside the of context and this is what I'm referring to.
So we are going to pass this of context into the use context here.
So here let's require the of context and now we are going to pass into this and here we go.
The next step is that we are going to assign the response or the result for calling this context to
a variable called state and is equal to that.
Now what is the state?
This state now represents the data inside our value provider, which is this one.
So any data you passing into this variable is available on this variable and this one can be anything.
Now if I console.log the states, let's see what we have.
Moment of truth.
Let's save it.
Now let's go to the component, which is a log in and now let's open our console.
Let's play this one and let's refresh again.
This one is are from the TV services classes.
So what we care most is about this.
We can see that we have access to its log in inside the log in component.
So let's say that we are adding additional method.
Let's say ADD.
I'm going to be a normal function here as that you can see I have access to what is called the ADD,
which is a function.
Now this is how we can consume context.
So in the next video, let's continue the implementation of logging in user.
All right, let's go, Roxanne, in the next video, guys.