Class
This base class defines some common methods for a widget. A widget is a React component. We don't recommend extending this class. Use the functional React component instead.
Constructors
Properties
Property | Type | Notes |
---|---|---|
(config: any) => any | A widget can just save partial of its config in an app config. In the runtime, the widget can use this function to get the full config. | |
(state: IMState, ownProps: Partial<AllWidgetProps<any>>) => any | The framework has injected many props into the widget props. Check | |
The version manager of a widget (optional) |
getFullConfig
getFullConfig: (config: any) => any
A widget can just save partial of its config in an app config. In the runtime, the widget can use this function to get the full config.
Type declaration
function(config: any): any
Parameters
Parameter | Type | Notes |
---|---|---|
config | any | The config saved in the app config |
Returns
any
The full config
mapExtraStateProps
mapExtraStateProps: (state: IMState, ownProps: Partial<AllWidgetProps<any>>) => any
The framework has injected many props into the widget props. Check AllWidgetProps
to see the details.
If your widget needs to use more state, you can use this function. However, for functional components, the useSelector
hook is recommended.
Type declaration
function(state: IMState, ownProps: Partial<AllWidgetProps<any>>): any
Parameters
Parameter | Type |
---|---|
state | IMState |
own | Partial<AllWidgetProps<any>> |
Returns
any
versionManager
versionManager: WidgetVersionManager | BaseVersionManager<any>
The version manager of a widget (optional)