Liking cljdoc? Tell your friends :D

deepstate.action


action-context-providerclj/smacro

(action-context-provider & args)

a ContextProvider element to provide an action-context

props:

  • context - the action-context React context
  • initial-arg - the initial state value
  • children - only the first child will be included as a child of the ContextProvider element
a ContextProvider element to provide an action-context

props:
- `context` - the `action-context` React context
- `initial-arg` - the initial `state` value
- `children` - only the first child will be included
               as a child of the `ContextProvider` element
sourceraw docstring

ActionContextProvidercljs

source

create-action-contextcljs

(create-action-context)

create the React Context object

create the React `Context` object
sourceraw docstring

def-actionclj/smacro

(def-action key [state-bindings action-bindings] & body)

define a generic action handler

  • key : the action key
  • state-bindings : fn bindings to destructure the state
  • action-bindings : fn bindings to destructure the action
  • body : any forms which return an action handle ActionEffects fn (i.e. a (fn <state>)). can use the action-bindings
define a generic action handler
- `key` : the action key
- `state-bindings` : fn bindings to destructure the state
- `action-bindings` : fn bindings to destructure the action
- `body` : any forms which return an action `handle` ActionEffects fn
           (i.e. a (fn <state>)). can use the `action-bindings`
sourceraw docstring

def-state-actionclj/smacro

(def-state-action key bindings & body)

define an action handler with only state effects

  • key : the action key
  • state-bindings : fn bindings to destructure the state
  • action-bindings : fn bindings to destructure the action
  • body : forms for a (fn <state>)->state . can use the action-bindings
define an action handler with only state effects
- `key` : the action key
- `state-bindings` : fn bindings to destructure the state
- `action-bindings` : fn bindings to destructure the action
- `body` : forms for a (fn <state>)->state .
           can use the `action-bindings`
sourceraw docstring

handlecljsmultimethod

handle a possibly asynchronous action

macros such as def-action, def-state-action and deepstate.action.async/def-async-action provide sugar to create implementations of this multimethod

  • action : the action map. must have key ::action which identifies the handler multimethod

returns: action-effects = (f state) -> {::state <state'> ::navigate <url> ::dispatch <ActionMap>|[<ActionMap>] ::later Promise<ActionEffects>}

i.e. handle returns a fn of state which, when invoked, returns a map of (all optional) effects, including ::state - updated state ::navigate - a url to navigate to ::dispatch - further ActionMaps to dispatch ::later - a Promise of another ActionEffects fn

handle a possibly asynchronous action

macros such as
[[def-action]], [[def-state-action]] and
[[deepstate.action.async/def-async-action]] provide
sugar to create implementations of this multimethod

- `action` : the `action` map. must have key `::action`
           which identifies the handler multimethod

returns:
  `action-effects` = (f state) ->
                      {::state <state'>
                       ::navigate <url>
                       ::dispatch <ActionMap>|[<ActionMap>]
                       ::later Promise<ActionEffects>}

i.e. handle returns a fn of `state` which, when invoked,
returns a map of (all optional) effects, including
  `::state` - updated state
  `::navigate` - a url to navigate to
  `::dispatch` - further ActionMaps to dispatch
  `::later` - a Promise of another ActionEffects fn
sourceraw docstring

sig5024cljs

source

use-actioncljs

(use-action ctx)
(use-action ctx path)

get a state value and dispatch fn

  • ctx - the action context
  • path - optional path into state for returned state value

returns: [state dispatch]

get a state value and dispatch fn

- `ctx` - the action context
- `path` - optional path into state for returned state value

returns:
  [state dispatch]
sourceraw docstring

use-action-contextcljs

(use-action-context ctx)

get the value from an action-context

get the value from an `action-context`
sourceraw docstring

use-action-dispatchcljs

(use-action-dispatch ctx)

get a dispatch fn

  • ctx - the action context
get a dispatch fn

- `ctx` - the action context
sourceraw docstring

use-action-statecljs

(use-action-state ctx)
(use-action-state ctx path)

extract the value at path (default nil) in the current state from an action-context

extract the value at `path` (default `nil`) in the current `state`
from an `action-context`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close