DEV Community

Discussion on: State machine advent: Let the machine handle accessibility for you (18/24)

codingdive profile image
Mikey Stengel Author • Edited on

Hey, thank you for reaching out. I'm glad you find them useful.

It's just a code preference and helps me think in events. One UI event handler = one event sent to the machine and possibly multiple actions, validations and side effects within the machine.

You can't ever do something like

<input onChange={(event) => void && send({ type: 'WRITE', input:}) /> 

As void true still yields undefined. Therefore, the event would never be sent. This forces me to write all the conditional code into the machine and keep as little logic in the UI as possible. 😊