1.0.4 • Published 3 years ago

reecrate v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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;
});
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago