Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.react.hooks

Simple wrappers for React hooks support, along with additional predefined functions that do useful things with hooks in the context of Fulcro.

Simple wrappers for React hooks support, along with additional predefined functions that do useful things
with hooks in the context of Fulcro.
raw docstring

use-callbackcljs

(use-callback cb)
(use-callback cb args)

A simple wrapper around React/useCallback. Converts args to js array before send.

React docs: https://reactjs.org/docs/hooks-reference.html#usecallback

A simple wrapper around React/useCallback. Converts args to js array before send.

React docs: https://reactjs.org/docs/hooks-reference.html#usecallback
sourceraw docstring

use-contextcljs

(use-context ctx)

A simple wrapper around React/useContext.

A simple wrapper around React/useContext.
sourceraw docstring

use-debug-valuecljs

(use-debug-value value)
(use-debug-value value formatter)

A simple wrapper around React/useDebugValue.

React docs: https://reactjs.org/docs/hooks-reference.html#uselayouteffect

A simple wrapper around React/useDebugValue.

React docs: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
sourceraw docstring

use-effectcljs

(use-effect f)
(use-effect f args)

A simple wrapper around React/useEffect.

React docs: https://reactjs.org/docs/hooks-reference.html#useeffect

A simple wrapper around React/useEffect.

React docs: https://reactjs.org/docs/hooks-reference.html#useeffect
sourceraw docstring

use-fulcro-mountcljs

(use-fulcro-mount parent-this {:keys [child-class initial-state-params]})

Generate a new sub-root.

;; important, you must use hooks (`defhc` or `:use-hooks? true`)
(defsc NewRoot [this props]
  {:use-hooks? true}
  (let [f (use-fulcro-mount this {:child-class SomeChild})]
    ;; parent props will show up in SomeChild as computed props.
    (f props)))

WARNING: Requires you use multi-root-renderer.

Generate a new sub-root.

```
;; important, you must use hooks (`defhc` or `:use-hooks? true`)
(defsc NewRoot [this props]
  {:use-hooks? true}
  (let [f (use-fulcro-mount this {:child-class SomeChild})]
    ;; parent props will show up in SomeChild as computed props.
    (f props)))
```

WARNING: Requires you use multi-root-renderer.
sourceraw docstring

use-gccljs

(use-gc this-or-app ident edges)

Effect handler. Creates an effect that will garbage-collect the given ident from fulcro app state on cleanup, and will follow any edges (a set of keywords) and remove any things pointed through those keywords as well. See normalized-state's remove-entity.

(defsc NewRoot [this props]
  {:use-hooks? true}
  (let [generated-id (hooks/use-generated-id)
        f (use-fulcro-mount this {:child-class SomeChild
                                  :initial-state-params {:id generated-id})]
    ;; will garbage-collect the floating root child on unmount
    (use-gc this [:child/id generated-id] #{})
    (f props)))
Effect handler. Creates an effect that will garbage-collect the given ident from fulcro app state on cleanup, and
will follow any `edges` (a set of keywords) and remove any things pointed through those keywords as well. See
normalized-state's `remove-entity`.

```
(defsc NewRoot [this props]
  {:use-hooks? true}
  (let [generated-id (hooks/use-generated-id)
        f (use-fulcro-mount this {:child-class SomeChild
                                  :initial-state-params {:id generated-id})]
    ;; will garbage-collect the floating root child on unmount
    (use-gc this [:child/id generated-id] #{})
    (f props)))
```
sourceraw docstring

use-generated-idcljs

(use-generated-id)

Returns a constant ident with a generated ID component.

Returns a constant ident with a generated ID component.
sourceraw docstring

use-imperative-handlecljs

(use-imperative-handle ref f)

A simple wrapper around React/useImperativeHandle.

React docs: https://reactjs.org/docs/hooks-reference.html#useimperativehandle

A simple wrapper around React/useImperativeHandle.

React docs: https://reactjs.org/docs/hooks-reference.html#useimperativehandle
sourceraw docstring

use-layout-effectcljs

(use-layout-effect f)
(use-layout-effect f args)

A simple wrapper around React/useLayoutEffect.

React docs: https://reactjs.org/docs/hooks-reference.html#uselayouteffect

A simple wrapper around React/useLayoutEffect.

React docs: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
sourceraw docstring

use-memocljs

(use-memo cb)
(use-memo cb args)

A simple wrapper around React/useMemo. Converts args to js array before send.

React docs: https://reactjs.org/docs/hooks-reference.html#usememo

A simple wrapper around React/useMemo. Converts args to js array before send.

React docs: https://reactjs.org/docs/hooks-reference.html#usememo
sourceraw docstring

use-reducercljs

(use-reducer reducer initial-arg)
(use-reducer reducer initial-arg init)

A simple wrapper around React/useReducer. Returns a cljs vector for easy destructuring

React docs: https://reactjs.org/docs/hooks-reference.html#usecontext

A simple wrapper around React/useReducer. Returns a cljs vector for easy destructuring

React docs: https://reactjs.org/docs/hooks-reference.html#usecontext
sourceraw docstring

use-refcljs

(use-ref)
(use-ref value)

A simple wrapper around React/useRef.

React docs: https://reactjs.org/docs/hooks-reference.html#useref

A simple wrapper around React/useRef.

React docs: https://reactjs.org/docs/hooks-reference.html#useref
sourceraw docstring

use-statecljs

(use-state initial-value)

A simple wrapper around React/useState. Returns a cljs vector for easy destructuring.

React docs: https://reactjs.org/docs/hooks-reference.html#usestate

A simple wrapper around React/useState. Returns a cljs vector for easy destructuring.

React docs: https://reactjs.org/docs/hooks-reference.html#usestate
sourceraw docstring

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

× close