(use-reducer reducer init-state)(use-reducer reducer init-state init)Just react/useReducer.
Just react/useReducer.
(use-ref x)Just like react/useRef. Supports accessing the "current" property via
dereference (@) and updating the "current" property via reset! and swap!
Just like react/useRef. Supports accessing the "current" property via dereference (@) and updating the "current" property via `reset!` and `swap!`
(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))
```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 |