I think you always want to think like a state machine. What are the actual finite states your component can be in at a given time?
Web development's shift from the imperative ("do this thing when there are changes over time") style to React's declarative style where UI is a function of State. However, there are still many ways to approach API design.
In this interview, Chance gives a guided tour behind the scenes of ReachUI. There's more thought that goes into seemingly simple interactions than you might think.