redux-xstate
redux-xstate copied to clipboard
[discussion] Redux Reducer vs xstate meta data.
Currently I'm not sure "State metadata" can fix that for redux.
noMiddleware solution: xstate-redux xstate discussion: State metadata xstate example save state machine in react state
In my mind "xstate actions" aren't equal to Redux reducer. So we need a separat ReducerMap, right?
reducerMap = {
TIMER: (state, {payload}) => ( payload )
}
store = createStore(
rootReducer,
applyMiddleware(
createMiddleware(machine, actionMap, reducerMap)
)
);
store.dispatch({
type: 'TIMER',
payload: {foo: 'bar'}
});
/*
store.machine = {
state: yellow,
data: {
foo: 'bar',
}
};
*/