Hi, I"m a Redux maintainer. Out of curiosity, any parts of our docs that you specifically feel "didn't click" for you? Any aspects of Redux you feel are particularly confusing?
FWIW, we would recommend against using separate action type string constants with Redux. That's part of the point of Redux Toolkit in the first place :) It still uses those inside, but you don't have to write them yourself.
import{createSlice}from'@reduxjs/toolkit'exportconstcounterSlice=createSlice({name:'counter',initialState:{value:0},reducers:{increment:state=>{// Redux Toolkit allows us to write "mutating" logic in reducers. It// doesn't actually mutate the state because it uses the immer library,// which detects changes to a "draft state" and produces a brand new// immutable state based off those changesstate.value+=1},decrement:state=>{state.value-=1},incrementByAmount:(state,action)=>{state.value+=action.payload}}})exportconst{increment,decrement,incrementByAmount}=counterSlice.actionsexportdefaultcounterSlice.reducer
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, I"m a Redux maintainer. Out of curiosity, any parts of our docs that you specifically feel "didn't click" for you? Any aspects of Redux you feel are particularly confusing?
FWIW, we would recommend against using separate action type string constants with Redux. That's part of the point of Redux Toolkit in the first place :) It still uses those inside, but you don't have to write them yourself.
Today a typical Redux reducer looks like this:
redux.js.org/tutorials/essentials/...