useDashboard

Deprecated

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

A React hook that provides access to the Dashboard SDK functions.

Signature

Copy
() => ReactSDK;

Returns

A ReactSDK object with the following functions:

Examples

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

Showing a toast

Copy
import { withDashboard, useDashboard } from "@wix/dashboard-react"; const DashboardExtension = () => { const { showToast } = useDashboard(); const showToastOnClick = () => { showToast({ message: "Hello World" }); }; return <button onClick={showToastOnClick}>Example</button>; }; // Wrap the topmost component of your dashboard extension with 'withDashboard()' export default withDashboard(DashboardExtension);
Did this help?