![]() Immutable updates required a lot of hand-written object spreads and array operations, and it was very easy to make mistakes and accidentally mutate state in the process (always the #1 cause of Redux bugs!). None of this code specifically depends on any API from the redux core library. You'd also probably have hand-written action creators and action type constants along with it: Prior to Redux Toolkit, you'd typically write that reducer with a switch statement and manual updates. The bad news is that there are no helpers to make any of your code easier to write.įor example, a reducer function is just a function. The good news is that this means Redux can be used in many different ways. Other than that, all the other Redux-related logic in your app has to be written entirely by you. compose to combine multiple store enhancers into a single store enhancer.applyMiddleware to combine multiple middleware into a store enhancer.combineReducers to combine multiple slice reducers into a single larger reducer.createStore to actually create a Redux store.The Redux core is a very small and deliberately unopinionated library. TypeScript types for actions, state, and other functionsĪdditionally, Redux is normally used with the React-Redux library to let your React components talk to a Redux store.The Redux DevTools Extension to view your action history and state changes.Memoized selector functions with the Reselect library for optimizing derived data.Normalized state to enable looking up items by ID.Thunk functions that contain sync or async logic with side effects.Action creators that generate those action objects. ![]() While it's not required, your Redux code also normally includes:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |