Render widgets by wrapping them in the PageWidgetsProvider component
The PageWidgetsProvider component wraps components that render widget components.
The following procedure shows how you can create a custom component to render widget components based on page URL. The query hook used for the URL is the usePageWidgets function.
To render widgets by wrapping them in the PageWidgetsProvider component:
-
In a folder called
widget_components, create a file calledcustomPageWidgets.js, paste the following code block, and customize for your widget components.NoteTo render widgets with the following
CustomPageWidgetscomponent:-
Pass your UI components through the
widget,setWidget, orsetWidgetTypefunctions before providing them toCustomPageWidgets.
-
-
In your React application, in the application component, to initialize and authenticate the JS SDK, paste the following code block.
-
At compile time, if errors are displayed, fix import statements to match locations and names.