Module

Halogen.Store.Connect

Package
purescript-halogen-store
Repository
thomashoneyman/purescript-halogen-store

#Connected Source

type Connected context input = { context :: context, input :: input }

The input type for connected components, containing the selected context from the store and the component's ordinary Halogen input.

#connect Source

connect :: forall action store context query input output m. MonadEffect m => MonadStore action store m => Selector store context -> Component query (Connected context input) output m -> Component query input output m

Connect a component to part of the store using a Selector. The selected state will be provided as part of the component's input. Any time the selected state changes the component will be notified with new input.

#subscribe Source

subscribe :: forall storeAction store context state action slots output m. MonadStore storeAction store m => Selector store context -> (context -> action) -> HalogenM state action slots output m Unit

Subscribe to changes in the selected state by providing an action to run any time the state updates. This can be used to connect components to the store with more manual control than connect provides.