score:1

class AppliedCandidates extends Component {
componentDidMount() {
  // here, the joblists props will get automatically updates from the dispatched redux action, dont mutate/change the props by yourself, change it via action.

  const { getAppliedJobs, joblists } = this.props;
  getAppliedJobs(joblists); // to be honest, why your action have the input of array and you put up id of individual array item? So I just put the entire joblists as the function parameter.

}

render() {
  const { appliedjobs } = this.props;

  if (appliedjobs.length === 0) {
    return null;
  }

  return ( // you can add more
    <ol>
      {appliedjobs.map(appliedjob => <li>{appliedjob.id}</li>)}
    </ol>
  )
}

const mapStateToProps = (state) => {
  return {
    joblists: state.getJobs.job,
    appliedjobs: state.getAppliedJobs.appliedjob
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    getAppliedJobs : (joblists) => dispatch(getAppliedJobs(joblists))
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(AppliedCandidates);

Related Query

More Query from same tag