title: Pass state to page on form submit?
body: <p>I have a state on one page, and when i submit a form I'd like to redirect to another page with the state of the source page, and populate the state on the new page with the old state on the old page haha if that makes sense. Hopefully my code attempt can explain it better.</p>
  
  <pre><code>class NewFormDetails extends Component {
      constructor(props) {
          super(props);
  
          this.state = {
              language: this.props.language,
              siteName: '',
              counties: '',
              siteAddress: '',
              siteEmail: '',
              siteNumber: '',
              siteCat: '',
              openTimes: '',
              fees: '',
              access: '',
              gps: '',
              w3w: '',
              txtHeader: '',
              txtContent: '',
              isLoading: false
          };
  
      }
  
      validateForm() {
          if (this.state.siteName != '' &amp;&amp;
              this.state.siteAddress != '' &amp;&amp;
              this.state.siteEmail != '' &amp;&amp;
              this.state.siteNumber != '' &amp;&amp;
              this.state.openTimes != '' &amp;&amp; 
              this.state.fees != '' &amp;&amp; 
              this.state.access != '' &amp;&amp; 
              this.state.gps != '' &amp;&amp; 
              this.state.w3w != '' &amp;&amp; 
              this.state.txtHeader != '' &amp;&amp; 
              this.state.txtContent != '') {
                  return true;
              } else {
                  return false;
              }
      }
  
      handleChange = e =&gt; {
          this.setState({ ...this.state, [e.target.name]: e.target.value });
          console.log(this.state);
      }
  
      handleSubmit = event =&gt; {
          event.preventDefault();
  
        /*  try {
              await this.createSiteDetails({
                siteName: this.state.siteName,
                siteAddress: this.state.siteAddress,
                siteCounty: this.state.counties,
                siteNumber: this.state.siteNumber,
                siteEmail: this.state.siteEmail,
                siteCategory: this.state.siteCat,
                siteOpeningTimes: this.state.openTimes,
                siteFees: this.state.fees,
                siteAccess: this.state.access,
                siteGPS: this.state.gps,
                siteW3W: this.state.w3w,
                siteHeaderText: this.state.txtHeader,
                siteContentText: this.state.txtContent
              });
              this.props.history.push("/");
            } catch (e) {
              alert(e);
              this.setState({ isLoading: false });
            } */
  
  
  
   console.log(this.state);
          this.props.history.push({
              pathname:"/newSite/tours",
              state:{
                  value: this.state
               }
             });
      }
  </code></pre>
  
  <p>And here is the page i redirect to and attempt to get the state from the other page</p>
  
  <pre><code>    class NewFormTours extends Component {
          constructor(props) {
              super(props);
  
              this.state = {
                  language: this.props.language,
                  tourName: '',
                  waypoints: '',
                  duration: '',
                  toursTxtHeader: '',
                  toursTxtContent: '',
                  siteName: this.siteName,
                  counties: this.props.counties,
                  siteAddress: this.props.siteAddress,
                  siteEmail: this.props.siteEmail,
                  siteNumber: this.props.siteNumber,
                  siteCat: this.props.siteCat,
                  openTimes: this.props.openTimes,
                  fees: this.props.fees,
                  access: this.props.access,
                  gps: this.props.gps,
                  w3w: this.props.w3w,
              detailsTxtHeader: this.props.detailsTxtHeader,
              detailsTxtContent: this.props.detailsTxtContent,  
          };
  </code></pre>