# observer ## observer ### Description The observer is a [HOC](https://reactjs.bootcss.com/docs/higher-order-components.html), which is used to add reactive features to react functional components. ### When to use When a component uses an [observable](https://reactive.formilyjs.org/api/observable) object inside, and you want the component to respond to changes in the observable object. ### API definition ```ts interface IObserverOptions { // Do you need observers to use forwardRef to pass ref attributes forwardRef?: boolean scheduler?: (updater: () => void) => void displayName?: string } function observer
( component: React.FunctionComponent
, options?: Options ): React.MemoExoticComponent< React.FunctionComponent< Options extends { forwardRef: true } ? React.PropsWithRef
: React.PropsWithoutRef
> > ``` ### Example ```tsx /** * defaultShowCode: true */ import React from 'react' import { observable } from '@formily/reactive' import { observer } from '@formily/reactive-react' const obs = observable({ value: 'Hello world', }) export default observer(() => { return (