Generaldeep Generaldeep - 7 months ago 47
React JSX Question

React, TypeError ( is not a function) on an Array obj

Thank you for stopping by to help. I am working with a react/redux app. One of the component is using a lifecyle method to retrieve data from an API. Once recieved, the data JSON data is held within an array. My initialState for the data coming back is an empty array.

When the component listening to the state change is mounted, the data is rendered on to the page, but then 2 seconds later I am getting a

Uncaught TypeError: is not a function

Component making the API call using lifecyle method and listening for state change

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getJobs } from '../../actions';
import { Card, Grid, Image, Feed } from 'semantic-ui-react';
// import './home.css';

const renderJobs = jobs =>, i) => (
<Card.Group stackable key={i}>
<Card className="jobscard">
<Card.Header href={job.detailUrl} target="_blank">{job.jobTitle}</Card.Header>

class GetJobs extends Component {

componentDidMount() {

render() {
const { jobs } = this.props;
return (
<div className="getjobs">

export default connect(({ jobs }) => ({ jobs }), { getJobs })(GetJobs);

Action creator/action

export const getJobsRequest = () => fetch('',
.then(res => res.json());

// action creator
export const getJobs = () => ({
type: 'GET_JOBS',
payload: getJobsRequest(),


import initialState from './initialState';

export default function (jobs =, action) {
switch (action.type) {
return {, isFetching: true };
return action.payload;
return jobs;
return jobs;

And intial state

export default {
userData: {},
jobs: [],

enter image description here

any thoughts on why this is happening?

Answer Source

You can put a simple check to ensure that your jobs is ready before you attempt rendering it.

{jobs.length && renderJobs(jobs)}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download