useDashboardSelector
Home > @gooddata/sdk-ui-dashboard > useDashboardSelector
useDashboardSelector variable
Hook for retrieving data from the dashboard state.
Signature:
useDashboardSelector: TypedUseSelectorHook<DashboardState>
Example
Example how to obtain all insights stored on the dashboard:
import { useDashboardSelector, selectInsights } from "@gooddata/sdk-ui-dashboard";
const CustomDashboardWidget = () => {
  const insights = useDashboardSelector(selectInsights);
  return (
     <pre>{JSON.stringify(insights, null, 2)}</pre>
  );
}