📜  react router dom 两页表单 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:56.093000             🧑  作者: Mango

代码示例1
handleSubmit = (event) => {
  event.preventDefault();
  this.props.history.replace({
    pathname: "/result",
    state: {
      value:
        "Your saving range is: $" +
        Math.floor(1.69 * this.state.square * (10 / 100)) +
        "- $" +
        Math.floor(1.69 * this.state.square * (30 / 100))
    }
  });
};

class Result extends Component {
  render() {
    return (
      

You could save between

{this.props.location.state.value}

// <-- route state Use Calculator Again
); } }