Dispatch Recognition

A dispatched action must be recognized by the reducer so that it can perform further actions. For our setActiveUserID, let's use the reducer to return the payload from the setUserID action i. e. the user id.

We'll cover the following

Previously, we dispatched the action to the activeUserID reducer, but the reducer had not been told what to do with it.

Let’s fix this, but don’t forget to remove the console.log(user_id) after inspecting the logs.

Have a look at the activeUserId reducer:

Get hands-on with 1200+ tech skills courses.