This API design is a feature, not a bug – one of the key features of declarative UI, in fact. Hoisting state out of things like dialogs and giving you full control means you don’t have to try to sync your state with the private state inside components you don’t control. There are a lot of talks and articles about the advantages of this.
That said, if you still want to write imperative code for this, that’s fine – but you probably shouldn’t be trying to use a declarative UI toolkit to do it.