react-use-wizard icon indicating copy to clipboard operation
react-use-wizard copied to clipboard

Route based wizard

Open tommy92 opened this issue 3 years ago • 0 comments

Is there any way to couple react-use-wizard with route-based views separate for each step?

Let's say I'm using Next.js and the structure would look like this:

/pages
  _app.tsx
  step1.tsx
  step2.tsx

and then:

// _app.tsx
import { Wizard } from 'react-use-wizard';

const MyApp = ({ children }) => (
  <Wizard>{children}</Wizard>
)
// step1.tsx
import { useWizard } from 'react-use-wizard';

const Step1 = () => {
  const { stepCount } = useWizard();

  console.log(stepCount) // should return 2, but actually returns 1

  return ...
}

tommy92 avatar Jul 05 '22 08:07 tommy92