react.observer
observer<P>(Component): React.FC<P>
Higher-Order Component (HOC) that transforms a React component into a fine-grained reactive observer.
| Name | Type | Description |
|---|---|---|
P |
extends object |
The props type accepted by the wrapped component. |
| Name | Type | Description |
|---|---|---|
Component |
ComponentType<P> |
The standard React component to wrap. |
React.FC<P>
A reactive observer React component.
Remarks
Any reactive signal or proxy property read during the render lifecycle of the wrapped component will be automatically tracked as a dependency. When any of those dependencies mutate, the component re-renders.
Example