Skip to content

Instantly share code, notes, and snippets.

@AlexLo33
Created June 12, 2019 07:54
Show Gist options
  • Save AlexLo33/66ef37526c15fa8c7b5186f2a446ada6 to your computer and use it in GitHub Desktop.
Save AlexLo33/66ef37526c15fa8c7b5186f2a446ada6 to your computer and use it in GitHub Desktop.
import { combineReducers } from 'redux';
import { createStore } from 'redux';
// create reducer 1
const is1 = 0;
const red1 = (state = is1, action) => {
switch(action.type) {
default: return state;
}
};
// create reducer 2
const is2 = "";
const red2 = (state = is2, action) => {
switch(action.type) {
default: return state;
}
};
// combine reducer 1 and 2
const allRed = combineReducers({
reducer1: red1,
reducer2: red2,
});
// create store from combined reducers
const store = createStore(allRed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment