lore-generate-reducer
Generates a new reducer in src/reducers
Generates a new reducer in src/reducers
CLI command to add an Reducer to your project.
lore generate reducer [reducer-name]
lore generate reducer example
The command above will generate a file located at src/reducers/example.js
that looks like this:
import _ from 'lodash';
import ActionTypes from '../constants/ActionTypes';
import PayloadStates from '../constants/PayloadStates';
const initialState = {
state: PayloadStates.INITIAL_STATE,
data: []
};
export default function(state = initialState, action) {
let nextState = _.assign({}, state);
switch (action.type) {
// case ActionTypes.FOUND_SOMETHING_COOL:
// // push the cool things into the array of other cool things
// return _.assign(nextState, {
// data: nextState.data.concat(action.payload.data)
// });
default:
return nextState
}
}