MicheleBertoli / react-automata

A state machine abstraction for React
MIT License
1.34k stars 60 forks source link

Initial Data is not set (or at least not accessable in props) #87

Open larsbuch opened 5 years ago

larsbuch commented 5 years ago

The initial data I set is not accessible in props This does not work:

const initialData = {
  stableState: 'stableStateA', 
  previousStates: []
}

export default withStateMachine(statechart, initialData)(App);

And neither does this:

const initialData = {
  stableState: 'stableStateA', 
  previousStates: []
}

export default withStateMachine(statechart, {initialData})(App);

Background is making a workaround for the not working history state with use of external state.

I cannot spot an error in my code. It works correctly after initial data has been overwritten via the transition

Test can be run via this: Code: https://repl.it/@larsbuch/React-Automata-HistoryTesting-InternalState