To keep track of any changes to the state of your InstantSearch widget, use the onStateChange prop on your InstantSearch object.
Please note that using onStateChange means that the instance is under your control. You’re responsible for updating the UI state (with setUiState). You can find more details about setUiState in our documentation.
For more information, visit our documentation about the InstantSearch object.