Well you are partially correct. There are many different types of state machines and the basic definition that binds all of them is that they have finite states and can only exist in one state at a time. What you are describing is called a Mealy state machine. That is a state machine where next state depends on previous state and external inputs. I have described a state machine which only depends on inputs.
The simplest way to convert it to what you want would be to do a conditional check inside the reducer.
function reducer(state, action){
if(state === SomeState){
switch(action.type){
I do not think there is one right way to do this. Accounting for previous state is, as I've mentioned in my post, a possible model but one that adds more complexity.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well you are partially correct. There are many different types of state machines and the basic definition that binds all of them is that they have finite states and can only exist in one state at a time. What you are describing is called a Mealy state machine. That is a state machine where next state depends on previous state and external inputs. I have described a state machine which only depends on inputs.
The simplest way to convert it to what you want would be to do a conditional check inside the reducer.
I do not think there is one right way to do this. Accounting for previous state is, as I've mentioned in my post, a possible model but one that adds more complexity.