And before we cover more complicated use state examples, let me just cover some things that relate
to all hooks.
So this will also relate to all the other hooks we'll learn later.
And first, we need to remember that as far as hooks, they will start with this use, whether that
is use, in fact, you state use callback use memo or whatever.
So you'll always see this use and that also applies to whatever hooks will create ourselves later on.
We must use this use in the beginning of the components where we invoke those hooks must be the uppercase.
So let me show you the example.
If, for example, I'll change this to a state basics and this is going to be with lowercase, you'll
see a big fat error.
So in order to use hook where there are, as you state, use a fact or whatever, the component needs
to be uppercase.
That is a small gotcher, but a small gotcher that can catch up with you and very random times.
Now also the hook needs to be in the function or component body.
For example, if you move this outside, it's not going to work again.
There's going to be a big fat error because you need to invoke the hook again with the writers, use
state or whichever hook you would want.
It needs to be invoked in the function body.
And then the last thing is something that will take a look at later, and that is that we cannot call
the hook conditionally.
And I'll show you that would use the fact because it's just going to make a little bit more sense.
Now, keep in mind, I'm not talking about the function that we're getting back from the default, because,
of course, in this case, yes, we're calling this conditionally where I'm checking the state value.
And when I'm saying, all right, so if the state is equal to a random title, then I'll invoke my handler
function.
Keep that in mind.
I'm not talking about this function.
Yes, this function you can call conditionally.
However, what I'm talking about is the fact that I cannot just say if I'm in some kind of hook inside
that is not going to work.
And it's going to be easier for me to share with you the fact because there's going to be a proper example.
Again, this applies to all the custom hooks.
We're going to create ourselves, as well as all the hooks that you can use from react, whether or
not use the fact use callback, you state or all the other hooks.