Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react router dom two page form

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 (
      <div className="result">
        <h2>You could save between</h2>
        <h1>{this.props.location.state.value}</h1> // <-- route state
        <NavLink to="/">Use Calculator Again</NavLink>
      </div>
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: conditionals monads javascript 
Javascript :: must line ending of word regex match 
Javascript :: useSate object 
Javascript :: how to decrease the size of js files build from angular 
Javascript :: jequery mose up 
Javascript :: usehistory forceRefresh 
Javascript :: jquery event when element is rendered 
Javascript :: Amazon Cognito domain on amplify not pulling 
Javascript :: update and fetch the new records in mongoose 
Javascript :: Stateful/Container/Smart component 
Javascript :: javascript array group duplicates 
Javascript :: google removing javascript from chrome 
Javascript :: how to log knex.raw query 
Javascript :: Assign keys to an object with the same name 
Javascript :: angular dynamic script loading 
Javascript :: socket mock 
Javascript :: reactvs y axis range 
Javascript :: verificar radio selected 
Javascript :: point towards mouse wick editor 
Javascript :: vue-jstree 
Javascript :: useEffect es6 format 
Javascript :: pragmatic view on the meaning of life 
Javascript :: javascript format hour 
Javascript :: Date.now beautiful human readable 
Javascript :: const is avaiable for es version 6 
Javascript :: check if object is empty js 
Javascript :: convert number to words javascript lakh 
Javascript :: silk carousel jquery 
Javascript :: pagination component 
Javascript :: Import UI library modularized in nuxtjs 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =