@univerjs/core v0.4.2 • Docs
Function: useDependencyValue()
function useDependencyValue<T>(depValue$, defaultValue?): T | undefined
unwrap an observable value, return it to the component for rendering, and trigger re-render when value changes
IMPORTANT. Parent and child components better not subscribe to the same
observable, otherwise unnecessary re-render would be triggered. Instead, the
top-most component should subscribe and pass value of the observable to
its offspring, by props or context. Please consider using useDependencyContext
and
useDependencyContextValue
in this case.
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
depValue$ | Observable <T > |
defaultValue ? | T |
Returns
T
| undefined
Deprecated
Please use useObservable
instead.
Defined in
submodules/univer/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:15