Home > @lynx-js/react > withInitDataInState
withInitDataInState() function
Higher-Order Component (HOC) that injects initData into the state of the given class component.
This HOC checks if the provided component is a class component. If it is, it wraps the component and injects the initData into its state. It also adds a listener to update the state when data changes, and removes the listener when the component unmounts.
Signature:
Parameters
Returns:
ComponentClass<P, S>
The original component if it is not a class component, otherwise a new class component with initData injection and state update functionality.

