Show HN: Rethinking the UI = F(State) Model

https://github.com/livetrails/targetjs
by ahmadwasfi • 5 months ago
1 0 5 months ago

Most modern frameworks model UI as a function of state: change state, re-render. but modern rich UX is increasingly about the space between states. It is about how to represent a smooth transition between states to have a fluid UI.

Today, we handle these "in-betweens" state by bolting on external libraries like Framer Motion or GSAP. These often feel like a continuous fight of synching two separate models.

I am building TargetJS to experiment with a different model: State as a Destination. In TargetJS, you don't just set a state instead you set a target for the framework to achieve. It treats the journey from state A to B as a first-class citizen.

Key Architectural Shifts:

- Implicit state and lifecycles: Every class field and function tracks its own progress.

- Linear execution: The code executes how it written from top to bottom with no jumps. Complicated flow are structuring the work into parent child relationship.

- Syncing to asynchronous operations is done by two modes: deferred and reactive.

- Built in fetching, events, efficient animation to provide one synced stack.

It's still in early stages, and I'm mostly looking for feedback on the developer experience of this model

Related Stories

Loading related stories...

Source preview

github.com