It's not the same redux-toolkit, there is not even a feature similar to redux-toolkit ․ I will explain now․
In redux-cool we can build our reducerTree with any deep and nested structure ․ which redux-toolkit cannot do. For example
const reducerTree = { PROFILE: { SET: (state, action) => { const [data] = action.args state.profile.data = data }, UPDATE_EMAIL: (state, action) => { const [email] = action.args state.profile.data.email = email } }, CLEAR: (state, action) => { state.profile.data = null } }
For example:
import {actionsCreator} from "redux-cool" const first_action = actionsCreator.MY.FIRST.ACTION("arg1", "arg2") console.log(first_action) // { // type: "MY/FIRST/ACTION", // args: ["arg1", "arg2"], // cb: f() identity, // _index: 1 // } const second_action = actionsCreator.This.is.my.second.action(2021) console.log(second_action) // { // type: "This/is/my/second/action", // args: [2021], // cb: f() identity, // _index: 2 // }
import {actionsCreator} from "redux-cool" const my_callback = () => { console.log("Hello, I am callback!!!") } const callbackable_action = actionsCreator.CALLBACKABLE.EXAMPLE(1, 2, 3, my_callback) console.log(callbackable_action) // { // type: "CALLBACKABLE/EXAMPLE", // args: [1, 2, 3], // cb: f() my_callback, // _index: 1 // } callbackable_action.cb() // "Hello, I am callback!!!"
Some comments have been hidden by the post's author - find out more
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
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