I am trying to build a simple FSM (finite state machine) in ReactJS functional components. I am looking at https://reactjs.org/docs/state-and-lifecycle.html#using-state-correct