Elmish integration for Fable.Lit. Unofficial build, republished from a fork while fixes are pending upstream.
Install
| Product | Versions |
|---|---|
| .NET Standard |
README
Fable.Lit.Elmish.Unofficial
Elmish loops driving lit templates.
dotnet add package Fable.Lit.Elmish.Unofficial
An Elmish program that renders into an element:
open Lit.Elmish
Program.mkProgram init update view
|> Program.withLit "app"
|> Program.run
Or a loop that belongs to one component, started and kept by it:
[<HookComponent>]
let Counter () =
let model, dispatch = Hook.useElmish (init, update)
view model dispatch
Beyond upstream
Program.withLitHydratedadopts markup that was rendered on the server byLit.Server.Unofficialrather than replacing it, andProgram.withLitHydratedInShadowRootdoes the same inside a declarative shadow root.- Mounting twice on one element hands over instead of colliding, which is what a hot update is: the new program starts from the model the old one had reached.
Program.stopOnstops a program mounted on an element, disposing its subscriptions and closing the loop, so a dispatch afterwards cannot render into an element nobody is looking at.
Note that Hook.useElmish does not stop its program when the component disconnects: the
model is disposed if it happens to be IDisposable, and nothing else. Subscriptions in a
component outlive it unless you tear them down yourself, because disconnection cannot tell
being moved from being removed.
Why "Unofficial"
This is a republished build of Fable.Lit by Alfonso GarcÃa-Caro Núñez and its contributors, packaged from a fork so that fixes can be used before they land upstream. The toolchain is .NET 10, Fable 5, Fable.Core 4 and lit 3.
Reference this or upstream Fable.Lit, never both: they share the Lit namespace.
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.