Hi, I'm the primary Redux maintainer. We already have an official Redux Toolkit package that does all of this same functionality already (generating action types/action creators, reducers that use Immer, etc), as well as additional features. It's also written in TypeScript and designed for a good TS usage experience. You should really be using Redux Toolkit instead:
import{createSlice}from'@reduxjs/toolkit'constinitialState=[]consttodosSlice=createSlice({name:'todos',initialState,reducers:{todoAdded(state,action){// ✅ This "mutating" code is okay inside of createSlice!state.push(action.payload)},todoToggled(state,action){consttodo=state.find(todo=>todo.id===action.payload)todo.completed=!todo.completed},})exportconst{todoAdded,todoToggled}=todosSlice.actionsexportdefaulttodosSlice.reducer
Yipes, no kidding. I don't think they had that username when they posted the story, so maybe they renamed their account? Flagged and reported for spam.
Hi, I'm the primary Redux maintainer. We already have an official Redux Toolkit package that does all of this same functionality already (generating action types/action creators, reducers that use Immer, etc), as well as additional features. It's also written in TypeScript and designed for a good TS usage experience. You should really be using Redux Toolkit instead:
See redux.js.org/tutorials/fundamental... for some examples of migrating existing Redux logic to RTK, and redux.js.org/tutorials/essentials/... for a larger tutorial that demonstrates building a "real-world" app with RTK.
WTF happened here, someone created a dev.to profile impersonating React, then posted THIS.
Community work been hard these days.
Yipes, no kidding. I don't think they had that username when they posted the story, so maybe they renamed their account? Flagged and reported for spam.
@mark
It's not the same redux-toolkit, there is not even a feature similar to redux-toolkit ․ I will explain now․
1. Nested reducers tree capability
In redux-cool we can build our reducerTree with any deep and nested structure ․ which redux-toolkit cannot do. For example
2. Ability to create actions independent of the reducer
For example:
3. Actions With Callback capability
For example:
4. See: here