title: How to pass the variable from one component to another
body: <p><strong>I know the question looks redundant, I've a different problem and I am not able to find it here.</strong></p>
  
  <p>I want a function to return an Id and that Id must me passed on to the another component</p>
  
  <p><strong><em>If you want the full code it is here</em></strong> <a href="https://codesandbox.io/s/qz7n1yy06j" rel="nofollow noreferrer">https://codesandbox.io/s/qz7n1yy06j</a></p>
  
  <p>mainpage.js</p>
  
  <pre><code>onEditClick(objectId){
          return &lt;EditRow objectId={objectId}/&gt;
      }
  </code></pre>
  
  <p>FYI I tried Console in the mainpage, it has the correct value, but when it is passed on to editrow, it becomes undefined.</p>
  
  <p>editrow.js</p>
  
  <pre><code>   class EditRow extends React.Component{
  
      renderTextField(field){
          return(
              &lt;div className="form-group"&gt;
                  &lt;label&gt;{field.label}&lt;/label&gt;
                  &lt;input
                      className="form-control"
                      type="text"
                      placeholder={field.placeholder}
                      {...field.input}
                      required
                  /&gt;
              &lt;/div&gt;
          )
      }
  
      onSubmit(values){
          this.props.editRow(values, () =&gt; {
              this.props.history.push('/login_success');
          },this.props.objectId);
      }
  
      render(){
          const {handleSubmit}=this.props;
  
          return(
              &lt;form onSubmit={handleSubmit(this.onSubmit.bind(this))}&gt;
                  &lt;Field
                      label={"Student Name"}
                      placeholder={"Enter the Name"}
                      name="name"
                      component={this.renderTextField}
                  /&gt;
                  &lt;Field
                      label={"Average Grade"}
                      placeholder={"Enter the Average grade"}
                      name="avgGrade"
                      component={this.renderTextField}
                  /&gt;
                  &lt;Field
                      label={"Curriculum / Occupation"}
                      placeholder={"Enter the Curriculum or Occupation"}
                      name="occupation"
                      component={this.renderTextField}
                  /&gt;
                  &lt;button className="btn btn-primary btn-right"&gt;Edit&lt;/button&gt;
              &lt;/form&gt;
          );
      }
  }
  
  export default reduxForm({form:'EditRow'})(connect (null,{editRow})(EditRow));
  </code></pre>
  
  <p>I'm trying to pass the value to the component when the form gets submitted. I surfed about this and got none. Real help would be nice.
  So please before giving minus points, give me the answer. Thank you</p>