title: req.body.jobId shows undefined when passing JobID from a React&Redux frontend to a NodeJS backend?
body: <p>Alright, this is going to be a little long. I'm somewhat new to React &amp; Redux. 
  So I have a React &amp; Redux front-end, with a Node &amp; Express backend as well as mySQL for the DB.</p>
  
  <p>I'm building part of a web portal, where users can create jobs. The job creation part is working fine, but I'm having trouble with retrieving data from the DB(GET request).</p>
  
  <p>Here's the structure:</p>
  
  <p>There's a postJobs.js parent, which has several child components:</p>
  
  <ol>
  <li>CreateJob</li>
  <li>AddMoreDetails</li>
  <li>AllocateBudget</li>
  </ol>
  
  <p>All of these child components are tabs which are triggered through clicking the tabs.</p>
  
  <p>When the job is created through the CreateJob component, a jobID is generated in the DB(primary key) which is then sent to the Redux Store.</p>
  
  <p>I'm using the same component, i.e. CreateJob for both adding a job and updating the job to prevent duplication.</p>
  
  <p>When the user successfully creates a job, he/she's navigated to the second tab(AddMoreDetails).</p>
  
  <p>I've defined an action for getting the created jobs from the db, and the action takes jobID as a parameter(the jobID is retrieved from the Redux store and passed to the action).</p>
  
  <p>But I get "job_id is undefined" in my Node backend. I've realized that it's not getting the jobId from req.body, but I'm unable to figure out an alternative as to how to send the jobID from the frontend to the backend.</p>
  
  <p>I've tested the API in Postman and it's working properly.</p>
  
  <p>Here's the error I'm getting and the relevant back-end and front-end code:</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>Unhandled rejection TypeError: Cannot read property 'job_id' of 
  undefined at jobsDao.getCurrentJob.then.result
  </code></pre>
  
  <p><strong>Backend</strong></p>
  
  <p><strong>userRouter.js</strong></p>
  
  <pre><code>router.get('/getCreatedJob', postJobController.getCreatedJob);
  </code></pre>
  
  <p><strong>postJob.js</strong></p>
  
  <pre><code>  let getCreatedJob = (req, res) =&gt; {
    let jobId = req.body.jobId;
    let skills = [];
    jobsDao.getCurrentJobSkills(jobId).then(result =&gt; {
      result.forEach(skill =&gt; {
      skills.push(skill.skill_id);
    });
  });
    jobsDao.getCurrentJob(jobId).then(result =&gt; {
      console.log(result);
      res.send({
        success: true,
        message: 'Got recent Created Job ',
        jobId: result[0].job_id,
        jobTitle: result[0].job_title,
        jobType: result[0].job_type_id,
        jobSkills: skills
       });
     });
   };
  </code></pre>
  
  <p><strong>jobsDao.js</strong></p>
  
  <pre><code>   let getCurrentJobSkills = jobId =&gt; {
       return Promise.using(getDBConnection(), connection =&gt; {
         return connection.query(
           `select skill_id from job_skill where job_id = 
            ${connection.escape(jobId)}`
        );
      });
     };
  
    let getCurrentJob = jobId =&gt; {
      return Promise.using(getDBConnection(), connection =&gt; {
        return connection.query(
          `select job_id,job_title,job_type_id from job where job_id 
           = ${connection.escape(jobId)}`
       );
     });
    };
  </code></pre>
  
  <p><strong>Front-End</strong></p>
  
  <p><strong>apiConfig.js</strong></p>
  
  <pre><code>export default {
     getCreatedJob: {
     url: '/api/secured/client/getCreatedJob',
     method: 'GET',
     data: {
       jobId: ''
     },
     showResultMessage: false,
     showErrorMessage: true
     }
     // Other API calls here
  }
  </code></pre>
  
  <p><strong>postJobAction.js</strong></p>
  
  <pre><code>export const actionGetCreatedJob = data =&gt; {
    const request = apiService('getCreatedJob', data);
    return {
      type: GET_CREATED_JOB,
      payload: request
    };
  };
  </code></pre>
  
  <p><strong>reducerPostJob.js</strong></p>
  
  <pre><code>export default (state = INITIAL_STATE, action) =&gt; {
    switch (action.type) {
      case GET_CREATED_JOB:
        console.log(action.payload.data);
        return { ...state };
      // Other cases here
      default:
      return state;
    }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>createJob.js</strong></p>
  
  <pre><code>componentDidMount() {
    const jobId = this.props.clientPostJob.jobId;
    console.log(jobId); // The createdJob is is being logged here 
                           correctly
    if (jobId) {
      this.props.actionGetCreatedJob({jobId})
      .then(() =&gt; {
        this.props.actionLoaderHide()
        /* Add logic here for populating the form fields with the 
          data retrieved from db */
      })
        .catch(err =&gt; console.log(err));
    }
  }
  
  const mapStateToProps = state =&gt; {
    return {
    clientPostJob: state.clientPostJob,
    userInfo: state.userInfo.userData,
    jobId: state.clientPostJob.jobId
   };
  };
  
  const mapDispatchToProps = dispatch =&gt; {
   return bindActionCreators({
       actionLoaderHide,
       actionLoaderShow,
       actionGetCreatedJob,
    },
    dispatch
    );
  };
  
  export default connect(
    mapStateToProps,
    mapDispatchToProps
  )(CreateJob);
  </code></pre>
  
  <p>What would be the best approach of sending the jobID to the backend?</p>