‫Let's now start using Redux Toolkit
‫by converting our store to this new modern way
‫of writing Redux.
‫And remember how I said that Redux Toolkit
‫is 100% compatible with the regular Redux,
‫which means that we can do this upgrade
‫in a very gradual way,
‫so we can start by only converting the store
‫but leaving our slices as they are
‫so that's really nice, again.
‫So, let's now start by, as always,
‫installing this new tool by writing NPM install
‫and now it is this @ symbol,
‫so @reduxJS
‫and then /toolkit.
‫So this looks a bit different from what we're used to,
‫but this is just because this @reduxJS
‫is basically a namespace
‫in which the creator of this namespace
‫then can publish multiple packages.
‫All right, so let's wait for that to install
‫and there it is.
‫And so remember how earlier we saw
‫that this create store here is deprecated
‫and so now indeed we will use
‫the configure store method instead.
‫So let's import configure store right here
‫from this package that we just installed.
‫So this configure store function basically wraps around
‫create store and adds a few functionalities to it.
‫So basically, configure store does a lot of things
‫automatically for us
‫so it automatically will combine our reducers,
‫it will automatically add the Thunk middleware,
‫and it will even automatically set up the developer tools,
‫so basically this part right here,
‫so all of this will happen automatically
‫and then in the end, of course,
‫our store is created and returned.
‫Now let's actually first duplicate this file here
‫so that you can once again also keep
‫basically the original older version.
‫So here, let's remove that again.
‫And then inside our actual store .JS,
‫we now can get rid of all of this stuff,
‫so we don't need any of this,
‫and instead all we need is this configure store.
‫And then we can also delete all of this
‫because all we need now is to call configure store
‫and then we pass it an object of options.
‫So here we can then specify the root reducer, basically,
‫so simply the reducer property,
‫and then, again, an object where we tell Redux Toolkit
‫about our two reducers.
‫So let's again call it account, which is account reducer,
‫and then also again customer, so customer reducer.
‫And this is actually it
‫so the result of this will be our store.
‫So then down there we export that
‫and so now our application is working
‫in exactly the same way as before,
‫and so, again, that's because we can upgrade
‫gradually to Redux Toolkit.
‫So see how extremely easy it now is
‫to set up a Redux application.
‫All we have to do is to call configure store
‫and pass it our two reducers.
‫That's it, nothing else we have to do.
‫Now then the part where we connect the React application
‫with Redux works in the exact same way as before
‫so nothing changes with the React Redux package
‫that we use on the React site.
‫All right, so this simplification
‫of setting up the store is already a huge win,
‫but React Toolkit can also help us
‫with writing the state slices themselves.
‫So here in the customer slice,
‫we can now basically write this entire logic
‫in a different way
‫and so let's see how in the next video.