Awesome ones, we're familiar with our setup ones, roll up our sleeves and finally write some code
and I guess we'll start by setting up our store and an excellent store is used to hold our data.
Now, you can also think of a store as a single source of truth and a way for us to manage the state
of our application.
And in order to get up and running with the store, you'll need following three things create store
function from the readers, a variable which will hold the value and then reduce their function.
And I guess I'm going to start by peeling off the create store function from the redox.
So let's write import.
Then it is a name they import, so I need to use the curly braces, create store from, you guessed
it, redacts, and then once we have imported the function now, we would want to set up the variable
that will hold the value.
And I can think of store as a place where we store our data.
Now I'm going to name one store, but as always, you can call it Bugs Bunny.
Doesn't really matter.
It's just a variable name.
But I'm going to go with store is equal create store.
Let's invoke it.
And if I say it without passing the register, you'll see that our application will blow up.
The reason why our application goes up is because Great Store is looking for the argument and the argument
it's looking for is the reducers function.
And you can think of reducers function as a way for us to update our store, not just to emphasize that
Reducer is a plain old JavaScript function as an argument.
I'm just going to pass here, empty arrow function, say it.
And as you can see now, my application works as expected and I will technically set up all our functionality
right here.
The problem with that approach is that the reducers normally hold quite a bit of code since all the
store functionality is right there.
So a more sane approach would be setting up a separate function and then just a reference that function.
And as a side note, as our application will grow, we will move reducer to its own file altogether.
So in my case, I'm going to create here comments.
I'm going to write a register.
Then, of course, you can write it as an arrow function.
But I'm just going to pick a good old the regular JavaScript function as I and as far as the name I
know, I'm going to go with reducer.
No parameters for the time being.
And then in the function body, I'm going to write a log.
If you are very conservative, you can go with Hello World or Hello Redox.
But since I feel like a rebel today, I'm going to go with Shake and Bake.
And of course I do need to reference the function.
Otherwise this does not make sense.
So let me reference the function and then I can see that my application didn't blow up.
And then also in the console I have shake and bake, which means that my producer is already to work.