Instructor: In the last section,
we started talking about higher order components.
We'll now continue by discussing a higher order component
that I can almost guarantee you
you have used already inside of a Redux application.
So let's get to it.
When we were working back on our testing application,
I very briefly showed you this diagram to give you an idea
of how that connect function was working
with that provider tag to give our components access
to data inside the Redux Store.
In this diagram right here, this Connect function,
the Connect function itself,
it is an example of a higher order component.
So every single time that you've been importing
that Connect function from React Redux
and using it to give a component access
to data stored inside of your Redux store,
you have been using a higher order component already.
So in this example, we are making use
of Connect as a higher order component, as a way
of sharing some code that's already been written inside
of a open source library with our components.
You and I could have just as easily,
well maybe not quite as easily, written out all the code
inside that connect function directly into our component.
So inside of our comment box and our comment list,
you and I could have written out a whole bunch
of code that would attempt to reach up to the provider tag
and get access to data inside the Redux store.
But you and I probably don't want to write out
all that code manually ourselves.
So rather than writing out that code manually,
we made use of code reuse
through these higher order components of the Connect tags.
So that's a great example
of higher order components that we've already
been making use of.
Now, of course, that doesn't really tell you how
to make higher order components
or how we actually put them together.
So let's take another quick pause.
We're gonna come back the next section
and we're gonna start talking about an application you
and I are going to build to give you a better idea
of how we put higher order components together ourselves.
So quick break, and I'll see you in just a minute.