Select.Primitive.State
- Package
- purescript-halogen-select
- Repository
- citizennet/purescript-halogen-select
#State Source
type State s q = Store s (ComponentHTML q)
All primitives use the Store
type as their component state. Any additional
data, like a traditional Halogen State record, will usually be provided.
Note: It's necessary to use a Store
comonad as the state type for primitives
because they receive their render function as input. The render function cannot
be stored in the State type synonym due to cycles, and as your component render
function can only take State
as its input, you need the render function available
via the comonad, StoreT.
s
: The state type defined for the primitiveq
: The query type defined for the primitive
#getState Source
getState :: forall a s m. MonadState (Store s a) m => m (Tuple (s -> a) s)
Helper to get and unpack the primitive state type from the Store type. When used with pattern matching, you can access state with:
(Tuple renderFunction state) <- getState
#updateStore Source
updateStore :: forall html state. (state -> html) -> (state -> state) -> Store state html -> Store state html
Helper for wholly updating the State
(Store
) of a primitive.
Used when the render
function needs to be updated.
Note: Use seeks
if only the primitive's internal state needs to be updated (not the entire Store).