Reactive MVU Architecture

Fable.Reaction is very similar to Elm and Elmish in regards to the MVU architecture. But when using Fable.Reaction, we do not need any commands (Cmd) or subscriptions with Elmish. Instead we use a ReactiveX (AsyncRx) style query that transforms the stream of messages (Msg).

  • Model, application state as immutable data
  • View, a pure function that takes the model to produce the output view (HTML elements)
  • Message, a data event that represents a change. Messages are generated by the view, or they may be generated by a stream, e.g. timer or initial message events.
  • Update, a pure function that produces a new model based on a received message and the previous model

In addition to the normal MVU architecture, Fable.Reaction also have a stream that transforms the “stream” of messages going from the view to the update function.

  • Stream, a function that takes the current model and the message stream and produces a new (transformed) message stream. Note that this also replaces the need for Elm(ish) commands (Cmd) since the stream is free to produce any messages (out of thin air), transform, filter, time-shift messages or combine side-effects such as web requests (fetch) etc.