react-albus
react-albus copied to clipboard
How to switch into specific step on click event from a button in another step
Is there any option to Switch to a specific step from on click
<Steps>
<Step id="gandalf">
<h1 className="text-align-center">Gandalf</h1>
<button className="btn-fluid margin-1-b" onClick={goTo('dumbledore')} >
Go to Dumbledore
</button>
</Step>
here I need to Switch to dumbledore When clicking Go to Dumbledore
@rahulgit when using Step's render prop, you have access to the router functions. From there, you can use push:
<Steps>
<Step id="gandalf" render={({ push }) => (
<>
<h1 className="text-align-center">Gandalf</h1>
<button className="btn-fluid margin-1-b" onClick={() => push('dumbledore')} >Go to Dumbledore</button>
</>
) />
//Other steps, including 'dumbledore'
</Steps>
You also have access to the push router function from the WithWizard component.
<WithWizard
render={({ push }) => ...
See https://github.com/americanexpress/react-albus#contextwizard for more info on what you can use from the wizard context.