Home > widget-integration > FilterStore > watch

FilterStore.watch() method

Subscribes to filter state changes.

Watch the entire state for any changes. Use this when you need to react to any state update regardless of which property changed.

Signature:

watch(callback: (state: FilterStates) => void): () => void;

Parameters

Parameter

Type

Description

callback

(state: FilterStates) => void

Function called with the entire state when any property changes

Returns:

() => void

Unsubscribe function to stop watching state changes

Example

Basic usage:

const unsubscribe = filterStore.watch((state) => {
  console.log('State changed:', state);
});
// Later, stop watching
unsubscribe();