withDashboard

Deprecated

This component is deprecated. For more information, see Migrating from dashboard-react.

This hook is temporarily required for use in Wix Patterns. It will continue to be supported while it is required.

A higher-order component that initializes the Wix React SDK and the Wix Dashboard SDK.

Wrap your topmost component with withDashboard(). This setup ensures that nested components can use hooks like useWixModules() and useDashboard() and that the dashboard's contextual state is passed to all child components.

Note: When you wrap a component with withDashboard(), a WixProvider component is initialized behind the scenes with the dashboard host and authentication strategy.

Signature

Copy

Parameters

NameTypeDescription
ComponentReact.ComponentType<P>A React component.

Returns

React.ComponentType<unknown>

Examples

To set up a dashboard client for React, refer to the setup guide.

Wrap a component

Here is a basic example of how to wrap a component using withDashboard.

Copy

Receive contextual state

This example shows how to retrieve a property called name from the dashboard's contextual state and use it in a component's code.

Copy
Did this help?