Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.react.context


create-contextclj/s

(create-context)
(create-context default-value)

Wrapper for React createContext. Returns a map containing :ui-consumer and :ui-provider factories, along with the raw :raw-context. The latter is what you would use with raw React useContext and such.

The ui-provider accepts a value and a single react element child.

(ui-provider 42
  (dom/div ...))

The ui-consumer expects to be passed a function (and can accept optional props):

(ui-consumer (fn [context-value] react-element))
(ui-consumer {:key n} (fn [context-value] react-element))
Wrapper for React createContext. Returns a map containing `:ui-consumer` and `:ui-provider` factories, along
with the raw `:raw-context`. The latter is what you would use with raw React useContext and such.

The ui-provider accepts a value and a single react element child.

```
(ui-provider 42
  (dom/div ...))
```

The ui-consumer expects to be passed a function (and can accept optional props):

```
(ui-consumer (fn [context-value] react-element))
(ui-consumer {:key n} (fn [context-value] react-element))
```

sourceraw docstring

current-context-valueclj/s

(current-context-value context)

Usable within render and component lifecycle methods. Gets the context value syncrhonously.

NOTE: May be flaky among different verions of react. Use at your own risk. Recommended that you use ui-consumer instead.

Usable within render and component lifecycle methods. Gets the context value syncrhonously.

NOTE: May be flaky among different verions of react. Use at your own risk. Recommended that you use `ui-consumer`
instead.
sourceraw docstring

set-class-context!clj/s

(set-class-context! C context)

Set the context type on the given component C (component based react).

Set the context type on the given component C (component based react).
sourceraw docstring

use-contextclj/s

(use-context wrapped-context)

React hook, but works with Fulcro-wrapped context from this ns.

React hook, but works with Fulcro-wrapped context from this ns.
sourceraw docstring

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

× close