observer() HOC
The observer() Higher-Order Component (HOC) is used to make React components reactive to changes in TeamPlay signals.
Syntax
Parameters
Component: The React component to be made reactive.
Return Value
Returns a new component that is reactive to TeamPlay signals.
Example
Features
-
Reactivity: Components wrapped with
observer()will automatically re-render when any TeamPlay signal they use changes. -
Suspense Integration:
observer()automatically wraps the component in a Suspense boundary, handling loading states for asynchronous operations.
Notes
- Always wrap components that use TeamPlay signals with
observer()to ensure they update when data changes. observer()optimizes re-renders by only updating when the specific data used in the component changes.