matthewp / robot

🤖 A functional, immutable Finite State Machine library
https://thisrobot.life
BSD 2-Clause "Simplified" License
1.92k stars 88 forks source link

Not understanding how to use the API #211

Closed johnwheeler closed 8 months ago

johnwheeler commented 8 months ago

Hi,

const [state, send, service] = useMachine(...)

It seems in order to use the child machine in conjunction with the parent machine, you MUST use 'service'

service.machine.current and service.child.machine.current

Is that correct?

matthewp commented 8 months ago

Correct.

johnwheeler commented 8 months ago

I wanted to mention. I wrestled with your library over the course of a week to refactor my app. I was able to get rid of about 20 booleans i was using in various combinations, and now I really feel like I understand how my app works. I'm not a fan of the atomic approach you took with the API, but I understand how it enables the composable nature, and you get away from the explosion of states. It was well worth it for me to learn and master robot 3. When my app is done, I'll put some attribution on it. Thanks!