Closed Miticcio closed 2 months ago
You should be able to pass your optional parameter through like this:
member this.useElmish<'model, 'msg>
(
init : unit -> 'model * Cmd<'msg>,
update: 'msg -> 'model -> 'model * Cmd<'msg>,
subscriptions: 'model -> Sub<'msg>,
?mapProgram: Program<unit, 'model, 'msg, unit> -> Program<unit, 'model, 'msg, unit>
) =
this.useElmish(
init = init,
update = update,
initArg = (),
subscriptions = Some(subscriptions),
?mapProgram = mapProgram)
Hi, I came across a scenario where I need to use the subscription feature of Elmish, inside a component state.\ Right now I haven't found a way to accomplish this, there is only the
ctx.useElmish(init, update)
extension for using Elmish inside a component but not for subscribing for external events.\ Is there a correct way to do this?Currently I have added a new overloading in the ElmishHook module and made some modifications to the existing function to allow custom subscriptions:
with
Used as follow:
I don't know if the
Option
class is the right way to achieve this.