So now it's time for us to see how to actually dispatch a circuit I.
O event inside the app using Redox, so inside the giant screen in here, let's import a functionality
from the Redux package.
This case, it's going to be a redux hook or right hook.
So it's going to be from react redux and it's going to be called use dispatch.
Let's import that and then let's make a variable of it here, dispatch, U.S. dispatch.
And then down here, we have deep button for joining the chat with the username.
Instead, we are going to pass the dispatch function where we pass in a action type.
In this case, it's going to be server slash join with the data property.
That is the username.
So it's a little different now, but that is how you dispatch actions inside of Redox, that's basically
how you make things change, make things happen inside Redox, that is by dispatching actions.
OK, now we can see there is a error here because we need to wrap our app around with a provider.
So let's go ahead and import the provider from the React Redux package, so import provider.
From React Redux.
And then we need to wrap our whole app around with this provider, tech, so provider.
And then we have our EP inside, and then we also need to set this store property of the provider tech
with this store that we created with Redox.
So now this provided tax enables us to access the redox actions and state from inside anywhere of our
components inside the componentry.
Now let's try and see what happens if I type in the username.
Well, first of all, the Keyport is covering up the key, the input.
We are going to fix that later.
But now, if I tried to type in something and say trying to chat, nothing happens.
So we need to also have a event inside this server case file for this server slash joint event.
Right now, we just have the joint event here.
Now, remember to add a break underneath each of the cases, LCD.
It's going to go through all of the cases even though you hit one case.
So make sure to have the break and let's say server slash join and then we have a joint event.
Got joint event with the election data, in this case, it's going to be the username and then we can
simply just copy this.
We have here not the handle message because we need to add a different implementation for that now since
we are using div redux actions instead.
OK, and remember to add a breakdown here.
Now, let's see what happens if I press and chat here, I get a little error because username is not
defined because it needs to be action, the data instead of username.
Before we had this event listener, which just said the data is username, but now we get the data as
action dot data.
So let's save that again and let's see what happens if I press change it now.
So now it says Godchaux, an event one one one.
So now we have successfully and communicated with our target, IUPAC and using the redirects actions
in here.
So even though the chad doesn't have any parent components, it still is able to access the socket I
opened.
Which is really great for a larger apps you're making now.
Let's move on to the next section where we need to well, we need to be able to also navigate to the
chat list or the list inside of the app.