The Elm Architecture[1] makes it easy to reason about code. You render the current state. You create a new state by applying a message to the current state.
1. https://guide.elm-lang.org/architecture/