Instructor: In the last section,
we finished up talking about testing
inside of a React and Redux application.
We're now gonna move forward
and start tackling our next big topic
which is higher order components.
We'll first begin
with a very plain English definition of what they are.
All right, so higher order component
is a normal react component that is specifically made
to help us reuse code inside of our application.
So if you have ever put together some component in an app
and then found yourself kind of copy pasting code around
from that component to another
and you have some amount
of code duplication between components,
that is a perfect use case for higher order components.
They are tools to allow us to de-duplicate code
or to reuse code inside of a application.
When we create higher order components
we then combine them together with normal components.
So an example of a normal component
would be like the app component or the comment box
or the comment list that we were just working on.
We take that normal component,
we combine it together with a higher order component,
and that leaves us with an enhanced or composed component.
This enhanced component has some additional amount
of functionality or data tied to it
thanks to some code that's essentially been donated to us
by the higher order component.
Okay, so just a quick definition right now.
That's all we're gonna talk
about for higher order components.
We're gonna continue now in the next section
and I'm gonna give you a very practical example
of a higher order component
that you have already been making use of
inside of every single redux application
possibly without you even knowing about it.
So let's take a quick break
and continue in the next section.