Module type Make.S

Many modules have the same shape, they declare the model, action, and result of the component, and then define apply_action and view over those types.

This is intended to be used with the Component.of_module function.

module Input : Core_kernel.T
module Model : Core_kernel.T
module Action : sig ... end
module Result : Core_kernel.T
val apply_action : inject:(Action.t -> Event.t) -> schedule_event:(Event.t -> unit) -> Input.t -> Model.t -> Action.t -> Model.t

apply_action is a transformation from a model and an action into a new model. During the transformation, the Component can also emit more actions via schedule_event or use Async to arrange for schedule_event to be called later.

val compute : inject:(Action.t -> Event.t) -> Input.t -> Model.t -> Result.t

Computes the Result.t of the component based off of the Model.t.

The inject argument is used to transform actions into Event.ts for use in event handlers like on_click.

val name : string

A name to identify this component.

A reasonable fallback is Source_code_position.to_string [%here].