Why incr_dom?
Declarative, Optimizable Web UIs
Inspired by React and Elm, Incr_dom allows developers to specify the view of their apps declaratively.
What sets Incr_dom apart is its integration with Incremental, an optimization framework for building computations that adapt quickly to changes to their inputs.
Incr_dom’s use of Incremental makes it easy to incrementally compute all sorts of data transformations within your UI. This is especially useful for building UIs that display views derived from large, dynamically changing datasets.
open Core_kernel
open Async_kernel
open Incr_dom
module Model = struct
type t = unit
let cutoff _ _ = true
end
module State = struct
type t = unit
end
module Action = struct
type t = Nothing.t [@@deriving sexp]
end
let initial_model = ()
let on_startup ~schedule_action:_ _model =
Deferred.unit
let create model ~old_model:_ ~inject:_ =
let open Incr.Let_syntax in
let%map model = model in
let apply_action action _ ~schedule_action:_ =
Nothing.unreachable_code action in
let view = Vdom.Node.text "hello world" in
Component.create ~apply_action model view
;;