MicheleBertoli / react-automata

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

Action methods are not receiving extState/event objects #63

Closed brianlawasdf123 closed 6 years ago

brianlawasdf123 commented 6 years ago

xstate shows an example of action methods receiving arguments extState, event http://davidkpiano.github.io/xstate/docs/#/api/actions?id=transitionactions

However, Component action methods don't seem to be receiving these arguments. Could they be added? https://github.com/MicheleBertoli/react-automata/blob/master/src/withStatechart.js#L78

Heres an example: https://codesandbox.io/s/0q7r7po9np

MicheleBertoli commented 6 years ago

Thank you very much for opening this issue @brianlawasdf123.

At the moment, actions don't receive any parameter because you can access those information through props or lifecycle hooks, but in the new version of this library that I'm currently writing I added the parameters to keep consistency with xstate.

Stay tuned!

MicheleBertoli commented 6 years ago

Hey @brianlawasdf123, v4 is out and now actions receive arguments.

screen shot 2018-08-09 at 3 34 04 pm
brianlawasdf123 commented 6 years ago

Awesome! Thanks.