Skip to content

For UI Development

Colin Kahn edited this page Oct 2, 2018 · 1 revision

The code that produces the UI has separate concerns than state management code, and for frameworks like Re-frame, dispatching actions is the loosely coupled way it communicates the intent of the user to change state. But the UI code has to also determine what to show the user based on the values of the current state.

Conceptually we should think of this state as having meaning in the context of what the user hopes to accomplish. It is the developers job to take the values of the state and output a representation that exposes the actions the user can perform, allowing them to achieve some tasks. Eliding the details of how to do such, we should see that the developer must hold an understanding of the values in the state and what they mean in terms of the actions they enable.

This problem is not in how we write the code that produces our UI but instead the implicitness of the relationship between each state and the actions it enables.

When defining a step spec consider conceptualizing each state as a collection of available actions. As a simple rule, each time the collection of available actions changes you'll want to define a new state.

Clone this wiki locally