Skip to content

Wrong order of events in state-machine code #499

@igittigitt

Description

@igittigitt

In your very finde article about state-machines
https://kentcdodds.com/blog/implementing-a-simple-state-machine-library-in-javascript
you put the onExit() and onEnter() events after the action() event:

destinationTransition.action()
currentStateDefinition.actions.onExit()
destinationStateDefinition.actions.onEnter()

Maybe i did not get the principles right, but wouldn't this order be the right one?

currentStateDefinition.actions.onExit()
destinationTransition.action()
destinationStateDefinition.actions.onEnter()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions