Description: #1270
Reproduction: https://codesandbox.io/s/xstate-customhook-bug-8u7gc?file=/src/App.js
useMachine starts a new machine. So in your example, you actually have 2 separate live toggle machines but you only send events to one of them. That's why the second one's state doesn't get updated and it displays 0 all the time.Thanks for your answer! @Andarist
useMachine? Is it impossible?If it is wrong way, how can I extract very complex/verbose logic made by useMachine? Is it impossible?
You would have to describe what exact problem do you have, I'm not sure what exactly is complex/verbose in your eyes so I can't answer this without learning more about your perspective.
I will close this as invalid - @baeharam Feel free to create a discussion if you want to talk about your use-case further.
Most helpful comment
useMachinestarts a new machine. So in your example, you actually have 2 separate live toggle machines but you only send events to one of them. That's why the second one's state doesn't get updated and it displays0all the time.