GoodData.UI API reference
  • GoodData.UI
  • Docs & APIs
  • Developers
  • GoodData.CN
  • GoodData.UI
  • Docs & APIs
  • Get GoodData.CN Community Edition
  • 10.26.0
  • Code samples
  • Gallery
  • GitHub

subscribeToStateChanges()

Home > @gooddata/sdk-ui-dashboard > IDashboardEventHandling > subscribeToStateChanges

IDashboardEventHandling.subscribeToStateChanges() method

Subscribe to state changes of the dashboard.

Signature:

subscribeToStateChanges(callback: DashboardStateChangeCallback): IDashboardEventHandling;

Parameters

ParameterTypeDescription
callbackDashboardStateChangeCallbackfunction to call when dashboard state changes; the function will be called with two parameters: the new state and an instance of dispatch to use.

Returns:

IDashboardEventHandling

self, for call chaining sakes

Remarks

There is no need to use this if all you need is your custom React components to get up-to-date state. Your React component code can (and really should) use the useDashboardSelector and useDashboardDispatch hooks instead.

Subscription to state changes is only really needed if you have custom code outside of React components and you need to extract custom data from state using the selectors API.

See also SingleDashboardStoreAccessor and DashboardStoreAccessorRepository for utility classes that make managing the callback subscriptions more convenient.

  • IDashboardEventHandling.subscribeToStateChanges() method
  • Parameters
  • Remarks
GoodData resources:
  • Documentation
Follow the community:
  • Community
Copyright © 2007–2025 GoodData Corporation. All Rights Reserved. Code licensed under a dual license - CC BY‑NC 4.0 for trial experience and GoodData.UI EULA for commercial use