Module
Radox.Internal.CreateStore
- Package
- purescript-radox
- Repository
- danieljharvey/purescript-radox
#createStore Source
createStore :: forall actionType stateType. stateType -> Listeners stateType -> CombinedReducer actionType stateType -> Effect (RadoxStore actionType stateType)
This creates a new Radox store
initialState
is how our state looks when we start
listeners
are an array of stateType -> Effect Unit functions that will be
sent the new state everything it is updated
'rootReduceris the function that takes our
actionTypeand a
stateTypeand returns the new
stateType`
This returns a RadoxStore, which has a dispatch
function for sending new actions
and a getState
function
#emptyStore Source
emptyStore :: forall actionType stateType. stateType -> RadoxStore actionType stateType
Things like React Context require us to provide a starting value, this allows us to pass one without using Effect.