lukesutton / buckle

A terminal UI library, with auto layouts, styling and other fancy stuff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UI state update and persistence

lukesutton opened this issue · comments

This shouldn't be built into every view, but if we want to allow widgets to be built on top of Buckle, we need to investigate how state can be stored and persisted for a view. Many widgets would have ephemeral state, which nonetheless needs to persist between re-renders.

SwiftUI does this using property wrappers, where the runtime inspects views for @State properties and automatically persists them.

React handles it by having a more complicated life-cycle, where views are managed by stateful components.

Ideally, we want something that is transparent to users if they don't care about it, but can be used if they wish to make their own stateful widgets on top of Buckle primitives.