Jump Tour Steps
Suppose if I wish to jump tour steps on condition. For example if a condition is satisfied it moves from index 0 to 3 else it moves from index 0 to 1. Is this possible?
@tragicmj yes, in the context returned by useSpotlightTour you have the method goTo(index), which should allow you to jump to any step. You can also use the current property in case you need to know the current step:
const { current, goTo, next } = useSpotlightTour();
const conditionalNext = (): void => {
current === 0
? goTo(condition ? 3 : 1)
: next()
};
However, I noticed the goTo(index) function is missing in the renders props of the TourStep component. I think that's something we can improve 🙂
:tada: This issue has been resolved in version 3.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: