redux-xstate icon indicating copy to clipboard operation
redux-xstate copied to clipboard

[discussion] Redux Reducer vs xstate meta data.

Open ClemensSahs opened this issue 7 years ago • 0 comments

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',
  }
};
*/

ClemensSahs avatar Jan 29 '18 23:01 ClemensSahs