Redux Finale - abukhalil-LTUC-ASAC/amman-401d4 GitHub Wiki
What comes next?
Whole lots, not much unless you want to expand into certain topics.
Redux Toolkit
Getting intoThese toolkits, more similar to guides than anything, helps guiding through the complexity of a true react-redux app with pre-defined wrap functions to otherwise commonly used operations. Want to add middleware to the store? use configureStore()
and many other helper wrappers.
configureStore()
does include the redux-devTools to track states on the browser at real time, and past-present time too, less dependencies to think about.createAction()
has been renamed to suit its general purpose, and even had some functionalities replaced by more specifically named functions such as.type()
instead oftoString()
.createReducer()
Now tell me this is not a better way to describe what is happening in a previously reducer switch now object lookup.
const counter = createReducer(0, {
[increment]: state => state + 1,
[decrement]: state => state - 1
})
createSlice()
helps doing the action creator shortcut using the lookup table from above, and an initial state to generate these creators for you.
Basically, a reduced way to Redux.
What about redux alternative?
There are a couple, you could still go back to context API or pure class willMount and such, however there are a couple of interesting alternatives that has the same benefits but less of the bad stuff.
- hookState seems like a solution that is very similar to React state Hooks, making use of their re-usability and such.
- Another more comprehensive library is the contender, MobX.
React, Reactive.
MakingOne of the many alternative is MobX, it came about as a solution to redux's solution to buggy and inconsistent state management architecture. What redux seems to offer is state immutability. But of course as we have seen, data needs to be normalized to avoid duplicated changed and hard to reach variables. Other problems involve concepts such as "referential integrity can no longer be guaranteed and it becomes next to impossible to use powerful concepts like classes in case you fancy those".
MobX makes state management simple again by addressing the root issue: it makes it impossible to produce an inconsistent state. The strategy to achieve that is simple: Make sure that everything that can be derived from the application state, will be derived. Automatically.