withDashboard

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() そして useDashboard() and that the dashboard's contextual state is passed to all child components.

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

署名

コピー
1

Parameters

名称タイプ説明
ComponentReact.ComponentType<P>A React component.

リターン

React.ComponentType<unknown>

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.

コピー
1

Receive contextual state

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

コピー
1
役に立ちましたか?
はい
いいえ