1.0.4 • Published 3 years ago
reecrate v1.0.4
Reecrate is a library to clone deep object to minimize the work that is clone a big store using the concept from redux "Immutable Update patterns", see in https://redux.js.org/recipes/structuring-reducers/immutable-update-patterns/
Without Reecrate:
const appReducer = (state, action) => {
switch (action.type) {
case "SET_DEEP_LOAD":
return {
...state,
screens: {
...state.screens,
loaders: {
...state.screens.loaders,
someScreen: {
...state.screens.loaders.someScreen,
active: true,
},
},
},
};
}
return state;
};
With Reecrate:
const appReducer = Reecrate.reducer((draft, action) => {
switch (action.type) {
case "SET_DEEP_LOAD":
draft.screens.loaders.someScreen.active = true;
}
return draft;
});