1handleSubmit = (event) => {
2 event.preventDefault();
3 this.props.history.replace({
4 pathname: "/result",
5 state: {
6 value:
7 "Your saving range is: $" +
8 Math.floor(1.69 * this.state.square * (10 / 100)) +
9 "- $" +
10 Math.floor(1.69 * this.state.square * (30 / 100))
11 }
12 });
13};
14
15class Result extends Component {
16 render() {
17 return (
18 <div className="result">
19 <h2>You could save between</h2>
20 <h1>{this.props.location.state.value}</h1> // <-- route state
21 <NavLink to="/">Use Calculator Again</NavLink>
22 </div>
23 );
24 }
25}