(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-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