Liking cljdoc? Tell your friends :D

helix.hooks

Wrapper around react hooks.

Many functions take a deps argument, corresponding to their React equivalent. This is an argument which can either be a a vector of deps or a special keyword:

vector of deps Use specified deps explicitly. :always Re-run hook on every render, equivalent to passing no deps vector to the hook. :once Equivalent to using [] as the deps. :auto-deps Infer the dependencies automatically from the code by finding local vars. Not available for the function form of a hook.

Wrapper around react hooks.

Many functions take a `deps` argument, corresponding to their React
equivalent.  This is an argument which can either be a a vector of
deps or a special keyword:

vector of deps  Use specified deps explicitly.
:always         Re-run hook on every render, equivalent to passing no deps
                vector to the hook.
:once           Equivalent to using [] as the deps.
:auto-deps      Infer the dependencies automatically from the code by finding
                local vars.  Not available for the function form of a hook.
raw docstring

deps-macro-bodyclj

(deps-macro-body env deps body deps->hook-body)
source

determine-depscljs

(determine-deps deps)
source

raw-use-callbackcljs

source

raw-use-effectcljs

source

raw-use-imperative-handlecljs

source

raw-use-layout-effectcljs

source

raw-use-memocljs

source

simple-body?clj/s

(simple-body? body)
source

use-callbackclj/smacro

(use-callback deps & fn-body)

Like react/useCallback. See namespace doc for deps. fn-body should be a code form which returns a function.

Like react/useCallback.  See namespace doc for `deps`.  `fn-body` should
be a code form which returns a function.
sourceraw docstring

use-callback*cljs

(use-callback* f)
(use-callback* f deps)

f is a function which will be passed to react/useCallback. See namespace doc for deps.

`f` is a function which will be passed to react/useCallback.  See
namespace doc for `deps`.
sourceraw docstring

use-contextcljs

Just react/useContext

Just react/useContext
sourceraw docstring

use-debug-valuecljs

Just react/useDebugValue

Just react/useDebugValue
sourceraw docstring

use-effectclj/smacro

(use-effect deps & body)

Like react/useEffect. See namespace doc for deps. body should be a code form which will be wrapped in a function and passed to react/useEffect. If it returns a function, that will be used to clean up.

Unlike react/useEffect, only if you return a function will it be used, you DO NOT need to return js/undefined.

Like react/useEffect.  See namespace doc for `deps`.  `body` should be a
code form which will be wrapped in a function and passed to
react/useEffect.  If it returns a function, that will be used to clean up.

Unlike react/useEffect, only if you return a function will it be used, you
DO NOT need to return js/undefined.
sourceraw docstring

use-effect*cljs

(use-effect* f)
(use-effect* f deps)

Like react/useEffect. See use-effect for details on what f's return values. See namespace doc for deps.

Like react/useEffect.  See `use-effect` for details on what `f`'s return values.  See namespace doc for `deps`.
sourceraw docstring

use-imperative-handleclj/smacro

(use-imperative-handle ref deps & body)

Like react/useImperativeHandle. ref is unchanged in meaning. See namespace doc for deps. body should be a code form which will be wrapped in a function.

Like react/useImperativeHandle.  `ref` is unchanged in meaning.  See
namespace doc for `deps`.  `body` should be a code form which will be
wrapped in a function.
sourceraw docstring

use-imperative-handle*cljs

(use-imperative-handle* ref f)
(use-imperative-handle* ref f deps)

Like react/useImperativeHandle. ref and f are unchanged in meaning. See namespace doc for deps

Like react/useImperativeHandle.  `ref` and `f` are unchanged in meaning.
See namespace doc for `deps`
sourceraw docstring

use-layout-effectclj/smacro

(use-layout-effect deps & body)

Like use-effect but instead calls react/useLayoutEffect.

Like `use-effect` but instead calls react/useLayoutEffect.
sourceraw docstring

use-layout-effect*cljs

(use-layout-effect* f)
(use-layout-effect* f deps)

Like use-effect* but instead calls react/useLayoutEffect.

Like `use-effect*` but instead calls react/useLayoutEffect.
sourceraw docstring

use-memoclj/smacro

(use-memo deps & body)

Like react/useMemo. See namespace doc for deps. body should be a code form which will be wrapped in a function.

Like react/useMemo.  See namespace doc for `deps`.  `body` should be a
code form which will be wrapped in a function.
sourceraw docstring

use-memo*cljs

(use-memo* f)
(use-memo* f deps)

Like react/useMemo. f is unchanged in meaning. See namespace doc for deps.

Like react/useMemo.  `f` is unchanged in meaning.  See namespace doc for
`deps`.
sourceraw docstring

use-reducercljs

(use-reducer reducer init-state)
(use-reducer reducer init-state init)

Just react/useReducer.

Just react/useReducer.
sourceraw docstring

use-refcljs

(use-ref x)

Like react/useRef. Supports accessing the "current" property via dereference (@) and updating the "current" property via reset! and swap!

Like react/useRef. Supports accessing the "current" property via
dereference (@) and updating the "current" property via `reset!` and
`swap!`
sourceraw docstring

use-statecljs

(use-state initial)

Like react/useState, but the update function returned can be used similar to swap!.

Example:

(let [[state set-state] (use-state {:count 0})]
 ;; ...
 (set-state update :count inc))
Like `react/useState`, but the update function returned can be used similar
to `swap!`.

Example:
```
(let [[state set-state] (use-state {:count 0})]
 ;; ...
 (set-state update :count inc))
```
sourceraw docstring

use-subscriptioncljs

(use-subscription {:keys [get-current-value subscribe]})

Hook used for safely managing subscriptions, respecting Clojure equality.

In order to avoid removing and re-adding subscriptions each time this hook is called, the parameters passed to this hook should be memoized in some way– either by wrapping the entire params object with use-memo or by wrapping the individual callbacks with use-callback.

Hook used for safely managing subscriptions, respecting Clojure equality.

In order to avoid removing and re-adding subscriptions each time this hook is
called, the parameters passed to this hook should be memoized in some way–
either by wrapping the entire params object with `use-memo` or by wrapping the
individual callbacks with `use-callback`.
sourceraw docstring

wrap-fxcljs

(wrap-fx f)
source

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

× close