These steps takes the numbers which are length of the steps array i.e
state = {
steps: [0, 1, 2, 3]
};
Later this state may change to
this.setState({
steps: [1,2,3,4]
});
Or
this.setState({
steps: [2,3,4,5]
});
and so on....
But in all the cases my steps show only 1,2,3,4,. I need to change those numbers according to the steps' array element.
This is the code for stepper.
<Stepper alternativeLabel nonLinear activeStep={activePage}>
{steps.map((step, index) => {
return (
<Step key={index}>
<StepButton
onClick={this.handleStep(index)}
disabled={dealsLoading}
>
</StepButton>
</Step>
);
})}
</Stepper>
How to achieve that?
If I use StepLabel component it looks like
But I don't want label. I want those labels should be on step buttons. Code for this:
<Stepper alternativeLabel nonLinear activeStep={activePage}>
{steps.map((step, index) => {
return (
<Step key={index}>
<StepLabel
onClick={this.handleStep(step)}
disabled={dealsLoading}
>
{step}
</StepLabel>
</Step>
);
})}
</Stepper>