In-App UI
React
Components
KnockGuideLocationSensor
KnockGuideLocationSensor
A React helper component intended for use with select supported frameworks, such as Next.js and Tanstack Router, for detecting route changes.
Activation rules for guides are evaluated as a user's location changes in your application and, by default, KnockGuideProvider listens for location change events from the global window object (enabled via the trackLocationFromWindow prop). However, modern frameworks often provide their own first class router APIs for detecting and reacting to route changes, which often works better and more reliably.
Two important notes to keep in mind when implementing KnockGuideLocationSensor:
- The import path is specific to the corresponding framework (e.g.,
@knocklabs/react/nextfor Next.js). KnockGuideLocationSensormust be placed insideKnockGuideProvider.