MCPcopy
hub / github.com/mobxjs/mobx / useObserver

Function useObserver

packages/mobx-react-lite/src/index.ts:22–29  ·  view source on GitHub ↗
(fn: () => T, baseComponentName: string = "observed")

Source from the content-addressed store, hash-verified

20export const clearTimers = observerFinalizationRegistry["finalizeAllImmediately"] ?? (() => {})
21
22export function useObserver<T>(fn: () => T, baseComponentName: string = "observed"): T {
23 if ("production" !== process.env.NODE_ENV) {
24 useDeprecated(
25 "[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`."
26 )
27 }
28 return useObserverOriginal(fn, baseComponentName)
29}
30
31export { isObserverBatched, observerBatching } from "./utils/observerBatching"
32

Callers 2

cFunction · 0.90
observer.test.tsxFile · 0.90

Calls 1

useDeprecatedFunction · 0.90

Tested by 1

cFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…