(use-batched-subscribe reaction)
Takes an atom-like ref type and returns a function that subscribes to changes
in the ref, where subscribed listeners execution is batched via react-dom/unstable_batchedUpdates
Takes an atom-like ref type and returns a function that subscribes to changes in the ref, where subscribed listeners execution is batched via `react-dom/unstable_batchedUpdates`
(use-reaction reaction)
(use-reaction reaction cleanup?)
Takes a Reagent Reaction and rerenders the UI component when the Reaction's value changes. Returns the current value of the Reaction
Takes a Reagent Reaction and rerenders the UI component when the Reaction's value changes. Returns the current value of the Reaction
(use-reaction2 reaction)
Takes Reagent's Reaction or RCursor, subscribes the UI component to changes in the Reaction and returns current state value of the Reaction
Takes Reagent's Reaction or RCursor, subscribes the UI component to changes in the Reaction and returns current state value of the Reaction
(use-sub-map subscribe datasource query-map)
A react hook that subscribes to multiple subscriptions, the return value of the hook is the return value of the subscriptions which will cause the consuming react function component to update when the subscriptions' values update.
Takes an optional data source (Reagent RAtom) and a hashmap
You can annotate any of the subscription vectors with ^:no-memo to emit a plain call to use-sub
that will not wrap the
subscription vector in a react/useMemo call.
You can also pass ^{:memo your-equality-fn} to change the memoization function used (for example to =
).
The single-arity version takes only a query map and will use the suscription datasource-context to read the Reagent RAtom from React context.
A react hook that subscribes to multiple subscriptions, the return value of the hook is the return value of the subscriptions which will cause the consuming react function component to update when the subscriptions' values update. Takes an optional data source (Reagent RAtom) and a hashmap - keys are keywords (qualified or simple) that you make up. - values are subscription vectors. Returns a map with the same keys and the values are the subscriptions subscribed and deref'd (thus, being their current values). You can annotate any of the subscription vectors with ^:no-memo to emit a plain call to `use-sub` that will not wrap the subscription vector in a react/useMemo call. You can also pass ^{:memo your-equality-fn} to change the memoization function used (for example to `=`). The single-arity version takes only a query map and will use the suscription datasource-context to read the Reagent RAtom from React context.
(use-sub-memo subscribe datasource subscription-vector)
Macro that expands expands to use-sub
, memoizes the subscription vector so that the underlying subscription
is reused across re-renders by React. If your subscription vector contains an arguments map literal, it is memoized with dependencies
being the values of the map. If you pass a symbol as the arguments the symbol will be used as the dependency for useMemo;
thus, you are expected to memoize the arguments yourself in that case.
If you pass a symbol for the entire subscription vector, no memoization takes place.
You can annotate the subscription vector with ^:no-memo to emit a plain call to use-sub
that will not wrap the
subscription vector in a react/useMemo call.
You can also pass ^{:memo your-equality-fn} to change the memoization function used (for example to =
).
Macro that expands expands to `use-sub`, memoizes the subscription vector so that the underlying subscription is reused across re-renders by React. If your subscription vector contains an arguments map literal, it is memoized with dependencies being the values of the map. If you pass a symbol as the arguments the symbol will be used as the dependency for useMemo; thus, you are expected to memoize the arguments yourself in that case. If you pass a symbol for the entire subscription vector, no memoization takes place. You can annotate the subscription vector with ^:no-memo to emit a plain call to `use-sub` that will not wrap the subscription vector in a react/useMemo call. You can also pass ^{:memo your-equality-fn} to change the memoization function used (for example to `=`).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close