As any UI framework, Humble UI needs some story for state management. Examples include:
Some intentionally vague constraints:
State management is tied to component syntax, so we are trying to figure out both at the same time.
And some desirable properties:
Let’s see how these problems are addressed in different existing solutions.
Component hierarchies in Humble UI are mostly static. That means your whole app is a value, not a function. You define it with def
, not defn
:
(def app
(ui/center
(ui/label "Hello, world")))
When you render it or handle an event, one and only instance handles each render and measure and on-event.
The downside of this approach is, well, it’s static. You can’t change your UI. At all. It react to window resize because size constraint is an input parameter to draw
method but that’s about it.