Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCurrentStep is undefined #41

Closed
kamaldeepj opened this issue Mar 18, 2021 · 1 comment
Closed

getCurrentStep is undefined #41

kamaldeepj opened this issue Mar 18, 2021 · 1 comment

Comments

@kamaldeepj
Copy link

I'm trying to get the current step info using the getCurrentStep function useTourGuideController. The function occasionally returns the current step info but most of the times the function is undefined. Is there any way for me to get the current step?

@gerwim
Copy link

gerwim commented Apr 26, 2021

I have the same issue, however you can work around this using the event stepChange.

E.g.:

const {
  eventEmitter, // an object for listening some events
} = useTourGuideController()


const handleOnStepChange = (step) => {
  console.log(step.order) // <--- will contain the current step
}

React.useEffect(() => {
  eventEmitter.on('stepChange', handleOnStepChange)

  return () => {
    eventEmitter.off('stepChange', handleOnStepChange)
  }
}, [])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants