-1

I need to save the user information in db when the screen is changed by user.

I am using React and Material UI Steppers.

tech_geek
  • 1,624
  • 3
  • 21
  • 44
Julian.ur
  • 129
  • 1
  • 7

1 Answers1

1

You can use an onClick function that calls an API endpoint that does the database saving for you when the user clicks on one of the steps, like so:

class ExampleComponent extends React.Component {
  handleStepperClick = () => {
    //Handle your API call here
  }

  render() {
    const steps = ["Step A", "Step B", "Step C"];

    return (
      <Stepper nonLinear >
        {steps.map((label, index) => (
          <Step key={index}>
            <StepButton onClick={this.handleStepperClick}>
              <StepLabel>{label}</StepLabel>
            </StepButton >
          </Step>
        ))}
      </Stepper>
    );
  }
}