redux-machine
redux-machine copied to clipboard
Enable diffrent INIT name
@mheiber
Enable diffrent INIT name.
what i mean is that - the machine requires a INIT property that holds reducer,
i want to be able to initialize the machine with other property name.
e.g
reduxStateMachine.createMachine({ INITNAME: fn(), nextStatus: fn() })
I feel a little bit silly for publishing a 12-line library, the state machine thing is more of a pattern. You can just do this:
const fetchUsersReducer = (state, action) => {
switch (state.status) {
case 'BEGIN':
return initReducer(state, action)
case 'IN_PROGRESS':
return inProgressReducer(state, action)
default:
return initReducer(state, action)
}
}