@@ -9,20 +9,9 @@ const withStatechart = (statechart, options = {}) => Component => {
99class StateMachine extends React . Component {
1010machine = statechart instanceof StateNode ?statechart :Machine ( statechart )
1111
12- lastEvent = null
13-
14- constructor ( props ) {
15- super ( props )
16-
17- const machineState =
18- this . props . initialMachineState || this . machine . initialState
19-
20- this . state = {
21- componentState :this . props . initialData ,
22- machineState,
23- }
24-
25- this . handleRef = ! isStateless ( Component ) ?this . handleRef :null
12+ state = {
13+ componentState :this . props . initialData ,
14+ machineState :this . props . initialMachineState || this . machine . initialState ,
2615}
2716
2817getChildContext ( ) {
@@ -111,10 +100,12 @@ const withStatechart = (statechart, options = {}) => Component => {
111100this . isTransitioning = false
112101}
113102
114- handleRef = element => {
103+ setInstance = element => {
115104this . instance = element
116105}
117106
107+ handleRef = ! isStateless ( Component ) ?this . setInstance :null
108+
118109handleTransition = ( event , updater ) => {
119110invariant (
120111! this . isTransitioning ,