Skip to content

Instantly share code, notes, and snippets.

@phated
Last active March 12, 2019 23:06
Show Gist options
  • Save phated/b4f8cce61eeb6157be39fd01328a28a7 to your computer and use it in GitHub Desktop.
Save phated/b4f8cce61eeb6157be39fd01328a28a7 to your computer and use it in GitHub Desktop.
Better Application Development in ReasonML

Better Application Development in ReasonML

With the introduction of Redux, The Elm Architecture, and ReasonReact’s reducerComponents, finite-state machines have become a popular way to develop front-end applications. Most of the libraries rely on a global state atom and don’t maintain a stack of states. Things like state transitions and reflecting the state in the URL are often an afterthought. They’re added as imperative side-effects, which become an unsustainable mess as the codebase grows.

If we focus on the URL from the beginning, we can evolve our finite-state machine by leveraging the browser’s History API, which maintains a stack of previous/next states for us.

In this talk, we’ll explore how Reason’s type system can be leveraged to ensure we are always thinking about our state transitions so they can be properly reflected in our URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment