Skip to content

Function: observer()

See

https://mobx.js.org/react-integration.html

Call Signature

ts
function observer<P, TRef>(baseComponent: ForwardRefRenderFunction<TRef, P>, options: IObserverOptions & {
  forwardRef: true;
}): MemoExoticComponent<ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>>;

Defined in: mobx-react-lite:

Type Parameters

Type ParameterDefault type
P extends object-
TRef{ }

Parameters

ParameterType
baseComponentForwardRefRenderFunction<TRef, P>
optionsIObserverOptions & { forwardRef: true; }

Returns

MemoExoticComponent<ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>>

Call Signature

ts
function observer<P>(baseComponent: FunctionComponent<P>, options?: IObserverOptions): FunctionComponent<P>;

Defined in: mobx-react-lite:

Type Parameters

Type Parameter
P extends object

Parameters

ParameterType
baseComponentFunctionComponent<P>
options?IObserverOptions

Returns

FunctionComponent<P>

Call Signature

ts
function observer<P, TRef>(baseComponent: ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>): MemoExoticComponent<ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>>;

Defined in: mobx-react-lite:

Type Parameters

Type ParameterDefault type
P extends object-
TRef{ }

Parameters

ParameterType
baseComponentForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>

Returns

MemoExoticComponent<ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>>>

Call Signature

ts
function observer<C, Options>(baseComponent: C, options?: Options): Options extends {
  forwardRef: true;
} ? C extends ForwardRefRenderFunction<TRef, P> ? C & NamedExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>> & {
  type: ForwardRefExoticComponent;
} : never : C & {
  displayName: string;
};

Defined in: mobx-react-lite:

Type Parameters

Type Parameter
C extends | FunctionComponent<any> | ForwardRefRenderFunction<any, { }>
Options extends IObserverOptions

Parameters

ParameterType
baseComponentC
options?Options

Returns

Options extends { forwardRef: true; } ? C extends ForwardRefRenderFunction<TRef, P> ? C & NamedExoticComponent<PropsWithoutRef<P> & RefAttributes<TRef>> & { type: ForwardRefExoticComponent; } : never : C & { displayName: string; }