Instructor: We've got our users reducer put together,
and we're making a very clear assumption here
that the action that's gonna deliver us our users
is going to have the type FETCH_USERS.
So let's flip back over to our action creators file
and make an action creator
that's going to return an action
that's gonna kind of match up with this API here.
So I'm gonna go into actions, index.js.
At the top, we'll first import our action type
which will be FETCH_USERS from ./types.
And then we'll immediately make our action creator.
Now, remember, the purpose of this action creator
is just to return a kind of default or static list of users.
So as the payload,
we're going to hard code the list of users.
Again, the entire point of this application
is we want to kind of put this user list together.
We're gonna have a bunch of static data,
and then we're gonna come back
and do the middleware at the end.
So let's create our function.
We'll export function fetchUsers,
and it's just gonna return an action
with type FETCH_USERS.
And payload, this is where we're gonna put
our static list of users.
So we're gonna have it be an array,
because that's kind of the the data contract we set up
inside the reducer.
We're assuming that it's gonna be an array.
And we're gonna assume
that it's an array of objects in particular.
And each object is going to represent one particular user.
For right now, we'll just say that each user has a name.
So here's user number one.
They've got a name of Jane.
We've got another user with the name of,
how about Alex?
And a name of Jim.
Cool, nice and straightforward.
So we've got our static list of data at this point,
and it's the only thing that's getting created,
or, excuse me, returned from our action creator.
So this kind of takes care of the redux side of things
for right now,
which means we should now flip over to our components
and put together our user list
or our component that's gonna show our list
of all the different users in the app.
Let's tackle that inside the next section.