(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))
```
(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.
(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).
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |