React Redux Toolkit Tutorial for Beginners | Learn Modern Redux
摘要
TLDRVideoen lærer seerne hvordan man implementerer Redux Toolkit for global tilstandsadministrasjon i React-applikasjoner. Den inneholder en introduksjon til Redux Toolkit, trinnvis veiledning til oppretting av et prosjekt, installering av avhengigheter og oppretting av en Redux-butikk. Det demonstreres også hvordan man lager handlinger for å manipulere en tellerverdi, med ekstra funksjoner for tilbakestilling og inkrementering med et spesifisert beløp, mens man bygger en enkel applikasjon for å vise funksjonaliteten i Redux Toolkit.
心得
- 🔍 Redux Toolkit er anbefalt for enklere tilstandsadministrasjon.
- 📦 Installer Redux Toolkit med npm.
- ⚙️ Opprett en Redux-butikk (store) for applikasjonen.
- 🧩 Bruk slices til å organisere tilstanden.
- ➕ Kall handlinger (actions) for å manipulere global tilstand.
- 🌐 Importer Provider for å gjøre tilstanden tilgjengelig.
- 📊 Bruk useSelector og useDispatch for å håndtere tilstanden.
- 💡 Legg til flere handlinger for å utvide funksjonaliteten.
- 🔄 Implementer reset-funksjonalitet for tilstanden.
- 📈 Demonstrer hvordan man oppdaterer tilstandsverdier effektivt.
时间轴
- 00:00:00 - 00:05:00
Introduksjon av Redux toolkit som den moderne metoden for å håndtere global tilstand i React-applikasjoner. Fokus på å implementere Redux toolkit er anbefalt av skaperne av Redux.
- 00:05:00 - 00:10:00
Opprettelse av en enkel prosjektstruktur i Visual Studio Code med nødvendige avhengigheter og konfigurasjon for Redux toolkit. Introduksjon av store-konfigurasjon og Provider for å gjøre den globale tilstanden tilgjengelig i applikasjonen.
- 00:10:00 - 00:15:00
Opprettelse av en funksjonsmappe for en teller (counter) med en 'slice' for å håndtere tilstand og handlinger knyttet til telleren. Definering av initial tilstand, reduserer og aksjoner som 'increment' og 'decrement'.
- 00:15:00 - 00:20:49
Implementering av tellerkomponenten som bruker Redux hooks (useSelector og useDispatch) for å navigere og manipulere global tilstand. Utvidelse av funksjonaliteten med nye handlinger som 'reset' og 'increment by amount' for mer interaktivitet.
思维导图
视频问答
Hva er forskjellen mellom Redux og Redux Toolkit?
Redux Toolkit er en moderne måte å implementere Redux på, designet for å gjøre kode enklere og mer effektiv.
Er denne opplæringen for nybegynnere?
Nei, denne opplæringen forutsetter en viss kunnskap om React, men er rettet mot nybegynnere i Redux Toolkit.
Hva er en 'slice' i Redux Toolkit?
En slice representerer en del av tilstanden i Redux, og inneholder logikken for endringene av denne tilstanden.
Hvordan kan jeg installere Redux Toolkit?
Du kan installere Redux Toolkit ved å bruke npm med kommandoen `npm install @reduxjs/toolkit react-redux`.
Hvilke handlinger (actions) ble demonstrert i videoen?
Handlingene som ble demonstrert inkluderer inkrementere, dekrementere, tilbakestille og inkrementere med beløp.
查看更多视频摘要
Give me 9min, and I'll improve your storytelling skills by 176%
Ancient Language Learning DESTROYS Modern Methods - How to Become Fluent FAST
Don’t Waste Your Time, You’re Not Young Forever! | 🎧 Podcast and Chill | Intermediate
It's Getting Pretty Bad For EA Games...
How To Learn Any Skill SO Fast It Feels Illegal
Kredite erklärt! Tilgung, Zinsen, Annuität...
- 00:00:00redux is the original old school global
- 00:00:02state manager for react but now the
- 00:00:04creators of redux offer redux toolkit
- 00:00:07and on the redux website it says redux
- 00:00:10toolkit is intended to be the standard
- 00:00:13way to write redux logic and we strongly
- 00:00:16recommend that you use it so moving
- 00:00:18forward redux toolkit is the modern
- 00:00:21application of redux that you should
- 00:00:23learn how to implement
- 00:00:25[Music]
- 00:00:29hello and welcome i'm dave today we're
- 00:00:32going to learn about implementing redux
- 00:00:34toolkit for global state management with
- 00:00:36react
- 00:00:37i'll provide links to example source
- 00:00:39code and all resources in the
- 00:00:41description below before we get started
- 00:00:44today please understand that this
- 00:00:45tutorial is not for absolute beginners
- 00:00:48in react it is for redux toolkit
- 00:00:50beginners but you should already have an
- 00:00:52understanding of react and at a minimum
- 00:00:55you should have already completed a
- 00:00:56react for beginners course like the one
- 00:00:58found on my channel or another one like
- 00:01:00it it would also be beneficial if you
- 00:01:03are already familiar with the built-in
- 00:01:05react hook use reducer because it has a
- 00:01:07lot of the same concepts and terminology
- 00:01:09that you find in redux overall redux is
- 00:01:12a global state manager that allows you
- 00:01:14to manage your app state in a single
- 00:01:16place which can be very useful
- 00:01:19the creators of redux now recommend
- 00:01:21implementing redux through the use of
- 00:01:23redux toolkit
- 00:01:24redux toolkit addresses several common
- 00:01:27complaints about redux including complex
- 00:01:29store configuration too many added
- 00:01:32packages and too much code to implement
- 00:01:34overall
- 00:01:35long story short redux toolkit is an
- 00:01:38easier modern way to implement the power
- 00:01:40of redux as a global state manager today
- 00:01:42we're going to create a simple example
- 00:01:44project to learn how to set up redux
- 00:01:46toolkit and get some initial exposure to
- 00:01:49how it all works so you can see here in
- 00:01:51visual studio code i have a basic
- 00:01:54project set up with very few
- 00:01:56dependencies so i've removed the things
- 00:01:58already that we will not be using i used
- 00:02:00create react app of course to create the
- 00:02:02project
- 00:02:04and then in the index js i've removed
- 00:02:06some of the boilerplate code that we
- 00:02:07don't usually use the same with the
- 00:02:09app.js
- 00:02:10and in the index.css i've put in some of
- 00:02:13my own css but of course you could get
- 00:02:16this from the source code in the
- 00:02:17description or you can just create your
- 00:02:20own what we're going to focus on today
- 00:02:22though is the logic of redux toolkit so
- 00:02:24back at the package json i'm going to
- 00:02:27open up a terminal window and we're
- 00:02:29going to go ahead and install redux
- 00:02:31toolkit okay we're going to use npm
- 00:02:34install and then we'll put the at symbol
- 00:02:37and redux js slash
- 00:02:40toolkit
- 00:02:41and then put react dash redux and press
- 00:02:44enter and this will install and as soon
- 00:02:47as it completes will be up and running
- 00:02:50and it's already ready to go okay i'm
- 00:02:52going to close out of the terminal
- 00:02:53window and in the source folder or the
- 00:02:56source directory of our file tree let's
- 00:02:58create another directory and name this
- 00:03:01app in all lower case now inside the app
- 00:03:05directory we're going to create a store
- 00:03:07and we'll just name it
- 00:03:08store.js okay redux store and redux are
- 00:03:13kind of used interchangeably both stand
- 00:03:15for a container for javascript apps and
- 00:03:18it stores the whole state of the app in
- 00:03:20an immutable object tree and really the
- 00:03:23intended pattern for redux is just to
- 00:03:25have a single store for your application
- 00:03:27multiple stores are possible but that is
- 00:03:30not what is recommended by the creators
- 00:03:32of redux to start our store we're going
- 00:03:35to import and then we want to import
- 00:03:38configure store from redux js slash
- 00:03:42toolkit and after we have that let's go
- 00:03:45ahead and just say export
- 00:03:47const
- 00:03:48set the store equal to
- 00:03:50that configure store
- 00:03:52and now inside the configure store we
- 00:03:54have an object and it holds a reducer
- 00:03:57now this reducer is going to be empty
- 00:04:00for now but we're going to come back and
- 00:04:03put in reducers that we create so we'll
- 00:04:06just save this file after creating our
- 00:04:08store we need to go back to the index js
- 00:04:11and import that so let's import
- 00:04:14now we'll have store
- 00:04:16and let's go ahead and say that is from
- 00:04:20our dot slash app and then slash store
- 00:04:25and besides that import we also need to
- 00:04:27import
- 00:04:28a provider which will provide this
- 00:04:31global state to our app so that comes
- 00:04:33from
- 00:04:34react dash redux
- 00:04:37and now that we have the provider if
- 00:04:38you're familiar with the context api and
- 00:04:41the use context hook this looks very
- 00:04:43familiar because we're just going to
- 00:04:45wrap the app in the provider
- 00:04:48and now we say store
- 00:04:49equal to store so we're passing that in
- 00:04:52and then we're going to have a closing
- 00:04:54tag for the provider of course and that
- 00:04:56needs to come after our app so we're
- 00:04:59wrapping the app with the provider and
- 00:05:01now our store our global state will be
- 00:05:04available to the app with that complete
- 00:05:06we need to create a features directory
- 00:05:09inside of our source directory so i'll
- 00:05:11click for a new directory and now i want
- 00:05:13to type
- 00:05:14features
- 00:05:15and now inside of this directory we're
- 00:05:18going to create another directory for
- 00:05:20our counter because we're creating a
- 00:05:22counter example today so that is one of
- 00:05:24the features and now this counter will
- 00:05:27have a slice and the name slice comes
- 00:05:30from splitting up redux state objects
- 00:05:32into multiple slices of state so a slice
- 00:05:36is really a collection of reducer logic
- 00:05:38and actions for a single feature in the
- 00:05:41app for example a blog might have a
- 00:05:43slice for posts and another slice for
- 00:05:46comments you would handle the logic of
- 00:05:48each differently so they each get their
- 00:05:50own slice so now for the counter we're
- 00:05:53going to create a slice so we're in the
- 00:05:55counter folder and i'll create a new
- 00:05:57file here and i'll name this counter
- 00:06:00slice with camelcase so a capital s dot
- 00:06:03js we'll start the counter slice with an
- 00:06:05import and here we need to import
- 00:06:08create slice and it comes from redux js
- 00:06:12toolkit and now we're going to create an
- 00:06:14initial state
- 00:06:16so that's exactly what we'll name this
- 00:06:18const
- 00:06:19and here we'll set this equal to
- 00:06:21count
- 00:06:22and we'll just start it with a value of
- 00:06:25zero
- 00:06:26now after that we need to go ahead and
- 00:06:28start to create our counter slice so
- 00:06:31i'll just type export const now counter
- 00:06:35slice
- 00:06:36we'll set this equal to our create slice
- 00:06:38that we've imported and now an object
- 00:06:41inside of it it starts with a name so
- 00:06:44let's just name this counter
- 00:06:47after that the second argument that will
- 00:06:49be passed in or the parameter as we
- 00:06:51define this is the initial
- 00:06:54state
- 00:06:55and then after that we have reducers and
- 00:06:58now this is where we would name all of
- 00:07:00our different actions this starts to
- 00:07:02look similar to the use reducer hook
- 00:07:05that is built in to react already so if
- 00:07:08you're familiar with that that will help
- 00:07:09but we're going to create a couple of
- 00:07:11actions for our counter one is increment
- 00:07:15and now we'll have an anonymous function
- 00:07:16here that receives the state
- 00:07:19and inside this we'll take the
- 00:07:21state.count that we defined above in our
- 00:07:23initial state and we'll just add one to
- 00:07:26the total
- 00:07:27and now i'm going to highlight this
- 00:07:30press shift alt down arrow to copy it
- 00:07:32down but remember we need a comma
- 00:07:34because this is an object so we have our
- 00:07:36increment and now let's change this
- 00:07:38increment to
- 00:07:40decrement which means we need to change
- 00:07:42the plus symbol to a minus and so this
- 00:07:44subtracts one from the total two so
- 00:07:46we've created two actions
- 00:07:48inside of our reducer
- 00:07:50now we need to export both our actions
- 00:07:53and our reducer so here i'll say export
- 00:07:56const and we'll destructure those
- 00:07:58actions so we have increment
- 00:08:02and decrement
- 00:08:04and then those are destructured from our
- 00:08:06counter slice
- 00:08:09dot actions and it looks like i need to
- 00:08:11press
- 00:08:12alt z to wrap the code i'm going to
- 00:08:14scroll this up so you can see it a
- 00:08:15little better as well actually i can
- 00:08:17just press ctrl b right now and you can
- 00:08:19see it all in one line that hides the
- 00:08:20file tree okay and at the bottom we need
- 00:08:24to say export default and here we'll
- 00:08:27take our counter slice again that we've
- 00:08:29created and this is the full reducer
- 00:08:31that we export here so let's save now
- 00:08:34both of these must be exported if we
- 00:08:36want to use these actions we need to
- 00:08:38export them and we can see they're
- 00:08:40available from the counter slice dot
- 00:08:42actions we also need to export the full
- 00:08:45reducer because the store will need that
- 00:08:48okay let's show the file tree again and
- 00:08:50now let's go back to the store because
- 00:08:52we need to import our reducer so at the
- 00:08:55top
- 00:08:56we'll say import and this will be
- 00:08:58counter reducer
- 00:09:00and that will be from now we'll have two
- 00:09:03dots
- 00:09:05features
- 00:09:06and then counter and finally
- 00:09:09counter slice and i'll press alt z to
- 00:09:12wrap this code so we can see it all at
- 00:09:13once now that we have the counter
- 00:09:15reducer we need to put it here in the
- 00:09:17reducer object where we save some space
- 00:09:20for it so we'll say counter and then
- 00:09:22counter
- 00:09:24reducer and save now we could easily
- 00:09:27have other slices that we're importing
- 00:09:30as well to the same store so we need to
- 00:09:32remember that and you might want to save
- 00:09:34a comma after each one and it doesn't
- 00:09:36hurt to have the comma even if you only
- 00:09:38have one in here now that we've added
- 00:09:40the counter reducer to the store it is
- 00:09:42available to the entire app through the
- 00:09:45provider that we put here in the index
- 00:09:47js and you can see the provider provides
- 00:09:50the store so with that available let's
- 00:09:53now create our counter component inside
- 00:09:55of the counter directory and we will
- 00:09:58have that logic available to us so let's
- 00:10:01go ahead and create counter with a
- 00:10:03capital c dot js now i have react es7
- 00:10:07snippets installed so i can type rafce
- 00:10:11and press enter and i get a functional
- 00:10:14expression component created quickly so
- 00:10:16if you don't have that you might want to
- 00:10:18look into that extension or just type
- 00:10:20out this basic stuff right here for our
- 00:10:23functional component
- 00:10:24now at the top of the file i want to
- 00:10:27import and i'm going to import a couple
- 00:10:29of hooks from redux one is called use
- 00:10:32selector
- 00:10:33and the other one is use
- 00:10:35dispatch
- 00:10:36and now that i have those imported let's
- 00:10:39go ahead and import our actions that we
- 00:10:41created so we have an increment
- 00:10:44and a decrement that we both created
- 00:10:47inside of that reducer the counter slice
- 00:10:50actually the counter reducer that's in
- 00:10:51the counter slice
- 00:10:53so this will come from
- 00:10:55the counter slice which we're already in
- 00:10:57the folder where it is so it's easy to
- 00:10:59navigate to with the imports complete
- 00:11:02let's go ahead and add our state to the
- 00:11:04component so here we'll have our count
- 00:11:07and we'll set that equal to
- 00:11:10use selector
- 00:11:11now inside the selector we'll reference
- 00:11:13the state
- 00:11:15now i'll have an arrow and i'll say
- 00:11:16state
- 00:11:17dot counter
- 00:11:19dot count once again i can see i'm
- 00:11:22exceeding the width so i'm going to
- 00:11:24press
- 00:11:25ctrl b to hide that file tree for now so
- 00:11:28we'll just stay in the component and you
- 00:11:29can see all of the code okay after count
- 00:11:32is defined i also want to define the
- 00:11:34dispatch
- 00:11:36and now with the dispatch we'll just set
- 00:11:37that equal to use
- 00:11:40dispatch we're now ready to add some jsx
- 00:11:44to the code here so i'm going to
- 00:11:45eliminate this div that we have
- 00:11:48and inside the jsx i'm going to create a
- 00:11:51section element
- 00:11:52and then inside of the section element a
- 00:11:55paragraph and the paragraph is just
- 00:11:56going to display our count state
- 00:11:59and after the paragraph i'm going to add
- 00:12:02a div
- 00:12:03and inside the div i'm going to have a
- 00:12:06button
- 00:12:07and this button is just going to have a
- 00:12:08plus symbol and then i could copy that
- 00:12:11down
- 00:12:12and then create one with a minus symbol
- 00:12:15now both of these need an on click as
- 00:12:18well so we'll set the on click equal to
- 00:12:21now we'll have an anonymous function and
- 00:12:23inside the anonymous function we can
- 00:12:25call
- 00:12:26the dispatch and inside the dispatch we
- 00:12:29can pass any of those actions we created
- 00:12:31so here we'll have the
- 00:12:33increment
- 00:12:34and now we call that inside the dispatch
- 00:12:36as well and actually i'll copy this down
- 00:12:38once again i should have waited to copy
- 00:12:40down before
- 00:12:42get rid of that extra button and now
- 00:12:44we'll just change this
- 00:12:46to our decrement
- 00:12:48and we'll change that plus symbol to a
- 00:12:50minus
- 00:12:51and that's our basic jsx here for the
- 00:12:54counter
- 00:12:55now we need to go back to the file tree
- 00:12:57into our app.js and we'll import the
- 00:12:59counter at the top
- 00:13:01so we'll say import
- 00:13:04counter
- 00:13:05and that's not what i wanted i just
- 00:13:07needed to import the counter component
- 00:13:10so import
- 00:13:12counter from and here it will be from
- 00:13:16features
- 00:13:18and then counter and finally there's our
- 00:13:21counter file
- 00:13:23okay inside the jsx
- 00:13:26we'll just put in
- 00:13:27the counter component and save now we're
- 00:13:30ready to open up a terminal window with
- 00:13:32control backtick type npm start
- 00:13:35and we'll see what happens with our app
- 00:13:37i'm going to drag over the visual studio
- 00:13:39code window so we can see both actually
- 00:13:42here we go so we've got the code on the
- 00:13:45left and the app on the right hide the
- 00:13:48file tree so we see more of the code
- 00:13:50okay plus
- 00:13:51that's working just fine
- 00:13:53decrement here so increment
- 00:13:56decrement everything's good with the
- 00:13:58basic app function here and of course
- 00:14:00this is a very simple example so it just
- 00:14:03shows you kind of how redux toolkit is
- 00:14:05set up and the structure overall for an
- 00:14:07application let's go ahead and add a
- 00:14:09couple of more actions so you can
- 00:14:11experiment a little bit with the pattern
- 00:14:13and see how more actions would be added
- 00:14:15i'm going to drag the code back over to
- 00:14:17full screen
- 00:14:19and now that we have that i'll close the
- 00:14:20terminal to add the new actions we need
- 00:14:23to go to our counter slice file and
- 00:14:25we'll just add more actions right here
- 00:14:27in this reducers object so the first one
- 00:14:29i want to add is a reset which is simply
- 00:14:32going to reset everything for us so
- 00:14:34we'll have our state
- 00:14:36and we'll set this to an anonymous
- 00:14:38function and here the state.count
- 00:14:41will just be set to zero so it resets
- 00:14:43the value for us
- 00:14:45now the next one i want to add will be
- 00:14:47just a little more complex but not too
- 00:14:49bad we'll call this increment
- 00:14:51by
- 00:14:52amount
- 00:14:53now it's going to receive not only the
- 00:14:55state
- 00:14:56but an action
- 00:14:58and now inside we'll go ahead and say
- 00:15:01state dot count
- 00:15:03and this is going to be actually plus
- 00:15:05equal
- 00:15:06and now we'll set the action dot payload
- 00:15:09once again this kind of goes back to
- 00:15:11referencing the use reducer hook because
- 00:15:13it also has payloads so here this will
- 00:15:16be an amount that we pass in and it will
- 00:15:19be in the payload of this function now
- 00:15:21after we add new actions we have to
- 00:15:24remember to go ahead and export those as
- 00:15:26well so here we'll export reset along
- 00:15:29with it and then increment by amount and
- 00:15:32save now we've already exported our
- 00:15:34reducer to the store so we don't need to
- 00:15:36do that again we've just added these new
- 00:15:38actions so let's just go back to the
- 00:15:40component and we can put these actions
- 00:15:42to work for us so we have increment
- 00:15:45and decrement and i'm going to put these
- 00:15:47on separate lines now so increment
- 00:15:49decrement
- 00:15:51and after that we're going to have
- 00:15:54reset
- 00:15:55and after that we'll have
- 00:15:58increment if i could spell increment
- 00:16:00there we go increment by amount
- 00:16:02and then we'll put that on another line
- 00:16:04and save that much to get the formatting
- 00:16:06so now we have our actions imported and
- 00:16:09i'm going to need to do one other import
- 00:16:11here
- 00:16:12and this will be import
- 00:16:15use state
- 00:16:17and there it is from react because we're
- 00:16:19going to use that for the amount that we
- 00:16:21choose to increment by
- 00:16:23so now besides these hooks that we have
- 00:16:26here let's go ahead and set up our state
- 00:16:29for that increment amount
- 00:16:31and let's just call it that increment
- 00:16:33amount and set
- 00:16:36increment
- 00:16:37amount
- 00:16:39now i'll set that equal to use state and
- 00:16:42we'll just start out with a value of
- 00:16:44zero i'm going to define one more
- 00:16:46variable here and it's just because
- 00:16:48we're going to use a text input so
- 00:16:51we need to verify that we get a number
- 00:16:54value so we'll say increment amount
- 00:16:56which is the state
- 00:16:58and if it is not a number we're checking
- 00:17:01it right there we'll just use the short
- 00:17:03circuit to set it equal to zero so we
- 00:17:06don't get a not a number value returned
- 00:17:09and this will ensure we have a number
- 00:17:11either added or it will at least be zero
- 00:17:13if a number is not in the input
- 00:17:16and now a quick function definition and
- 00:17:18i'll call this reset all
- 00:17:20because i would not only want to reset
- 00:17:22the state i want to
- 00:17:24reset our use state value of the
- 00:17:26incremented amount as well so we'll say
- 00:17:28set
- 00:17:30increment amount and we'll set that to
- 00:17:32zero and then we'll also use our
- 00:17:34dispatch that will set our global state
- 00:17:37using the reset action
- 00:17:39and that will be set back to zero as
- 00:17:41well with that action that we defined
- 00:17:43now let's put these to work inside the
- 00:17:45jsx so inside of this section that we've
- 00:17:48already created
- 00:17:49let's go ahead and add an input element
- 00:17:53and besides the input it says type text
- 00:17:56i guess that would be okay
- 00:17:58let's put this on another line and tab
- 00:18:01in there we go
- 00:18:03so besides the text attribute let's go
- 00:18:05ahead and add a value attribute to make
- 00:18:08this a controlled input and it will have
- 00:18:10the increment
- 00:18:11amount that we defined in use state
- 00:18:14and then it's going to have an on change
- 00:18:17and we set that equal to an anonymous
- 00:18:19function that gets
- 00:18:21the event and then inside of this we'll
- 00:18:24say set
- 00:18:25increment amount and we pass in the e
- 00:18:28dot target dot value so just a
- 00:18:30traditional controlled input for us
- 00:18:33after the input i'm going to scroll up
- 00:18:35for some more room i want to add another
- 00:18:38div
- 00:18:39and then inside the div i'm going to
- 00:18:40have two buttons again so i'll have a
- 00:18:43button
- 00:18:44and let's say on this button
- 00:18:46add amount and let's go ahead and add
- 00:18:49the on click here for the button as well
- 00:18:51so
- 00:18:52on click
- 00:18:53equals an anonymous function
- 00:18:56and our pattern before stays the same so
- 00:18:58then we call dispatch
- 00:19:00and now we'll say
- 00:19:02increment by amount which is a little
- 00:19:05bit longer name for our action but
- 00:19:06that's what it is and then we'll just
- 00:19:08pass in that add value variable that i
- 00:19:10defined above i'm going to press
- 00:19:12alt z to wrap the code so you can see it
- 00:19:14all so we defined add value to make sure
- 00:19:17that it was a number so it's either 0 or
- 00:19:21the number that is input and that was
- 00:19:22defined above but here we're calling our
- 00:19:25action with dispatch once again now i'm
- 00:19:28going to copy this down and the on click
- 00:19:30here for the second button will be much
- 00:19:32simpler we'll just pass in
- 00:19:34the reset all function that we defined
- 00:19:36above and here instead of add amount
- 00:19:40we'll just put
- 00:19:42reset just one t and save okay i'm going
- 00:19:45to drag visual studio code over to the
- 00:19:47left and we can see our component it now
- 00:19:49has the new input and the new buttons as
- 00:19:51well so any amount that we add here say
- 00:19:5410 and we click add amount
- 00:19:56our state is going up by tens and if we
- 00:19:59reset yes it sets both to zero see if we
- 00:20:02can put in a negative number
- 00:20:04negative two and we add yep that works
- 00:20:07too so anything we put in here and of
- 00:20:10course an abc shouldn't work it should
- 00:20:12identify so yeah it's just zero there so
- 00:20:14that doesn't change anything so if we go
- 00:20:16by twos we can go back up
- 00:20:19all good so our app is working and
- 00:20:21overall this shows you how to implement
- 00:20:23a simple state and some basic actions
- 00:20:26and get the whole redux toolkit
- 00:20:28structure up and running remember to
- 00:20:30keep striving for progress over
- 00:20:32perfection and a little progress every
- 00:20:34day will go a very long way please give
- 00:20:37this video a like if it's helped you and
- 00:20:39thank you for watching and subscribing
- 00:20:41you're helping my channel grow have a
- 00:20:43great day and let's write more code
- 00:20:45together very soon
- Redux
- Redux Toolkit
- React
- State Management
- Global State
- JavaScript
- Web Development
- Front-end Development
- Counter Example
- Tutorial