Can we use spotlightClicks without a controlled/stepIndex mode? #665
-
I've set up a simple demo in sandbox with a basic set-up. Step 4 uses Button1 as a target, and I've set the prop for Step 4 Do I need to switch to controlled mode to use this feature or can it be achieved with the basic set up? Also (bonus question), if using the spotlightClicks feature to click a button to another page (using react router), can Joyride move from my id="#button1" element in Step 4, to a new element (eg id="button2"), on another page? I'm wondering if there's a point between closing one route and opening another where Joyride has no target and this might break the component. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
hey @jimmythecode The If you need the tour to work in different contexts (routes in your case) then you'll need to use the controlled mode. You'll need a handler in this button to stop the tour, increase the stepIndex, and after the route loads (and your next target is visible) start the tour again. |
Beta Was this translation helpful? Give feedback.
hey @jimmythecode
The
spotlightClicks
works with both modes, uncontrolled or controlled.However, this library only has control of the elements it creates, so clicking a button in your code won't have any direct effect on the tour...
If you need the tour to work in different contexts (routes in your case) then you'll need to use the controlled mode.
You'll need a handler in this button to stop the tour, increase the stepIndex, and after the route loads (and your next target is visible) start the tour again.