Elmish implements core abstractions that can be used to build applications following “model view update” style of architecture, as made famous by Elm. The library however does not model any "view" and is intended for use in conjuction with a DOM/renderer, like React/ReactNative or VirtualDOM. For those familiar with Redux, the Fable applications targeting React or ReactNative may find Elmish a more natural fit than Redux allowing one to stay completely in idiomatic F#.
Elmish abstractions have been carefully designed to resemble Elm's "look and feel" and anyone familiar with post-Signal Elm terminology will find themselves at right home.
npm install --save fable-core fable-powerpack fable-elmish
Add a reference to the assemblies in the package folders (e.g.
Note that by itself the following program expects the
viewto carry out both DOM construction and DOM rendering.
open ElmishProgram.mkProgram init update view|> Program.run
open ElmishCmd.ofAsync asyncFunction arg ofSuccess ofError
open ElmishCmd.ofPromise promiseFunction arg ofSuccess ofError
This type is standard in F# 4.1 and will be removed from this lib when MS releases it.
open Elmish.Browser.NavigationProgram.mkProgram init update view|> Program.toNavigable parser urlUpdate|> Program.run