I am building a react application. I am using Redux to store my state. I am making a request to a back end API which is returning the following data:
{
name: '2020 Crimes Against Women Virtual Conference',
status: 'In Progress',
state: 'Texas',
county: '',
district: 'Texas-32',
type: 'Conference/Workshop',
typeNumber: 102,
fundingSource: '03-350204',
fundingSourceName:
'FY 19 Internet Crimes Against Children National Training',
fundingSourceGoal: 'Training',
startDate: '04/01/2020',
endDate: '04/05/2020',
fundingPercent: 100,
contact: 'Shawn Guy',
projectStartDate: '04/01/2020',
projectEndDate: '',
goalsAndObjectives:
'Provide training through various virtual platforms instead of the in-person conference for the 2020 Crimes Against Women Conference.',
successDescription: '...',
accountableStaff: [
{
lastName: 'Wagner',
firstName: 'Lauren'
},
{
lastName: 'Trenary',
firstName: 'John'
},
{
lastName: 'Lott',
firstName: 'Timothy'
}
],
projectId: 4481
},
I am then rendering the data in a component. I am able to access most of the data through a straight .notation
<Button buttonName='Edit Project' />
</div>
<div style={{ backgroundColor: '#F8F8F8' }}>
<Table className='borderless'>
<tbody>
<tr>
<td>
<strong>Name: </strong>
{projects.name}
</td>
<td>
<strong>Status: </strong>
{projects.status}
</td>
</tr>
<tr>
<td>
<strong>State: </strong>
{projects.state}
</td>
<td>
<strong>County: </strong>
{projects.county}
</td>
</tr>
<tr>
<td>
<strong>Congressional District: </strong>
{projects.district}
</td>
<td>
<strong>Type: </strong>
{projects.type}
</td>
</tr>
<tr>
<td>
<strong>Funding Source: </strong>
<br />
{`${projects.fundingSource} ${projects.fundingSourceName}`}
</td>
<td>
<strong>Funding Source Goal: </strong>
<br />
{projects.fundingSourceGoal}
</td>
<td>
<strong>Start Date: </strong>
<br />
<Moment format='MM/DD/YYYY'>{projects.startDate}</Moment>
</td>
<td>
<strong>End Date: </strong>
<br />
{projects.endDate === null ? (
''
) : (
<Moment format='MM/DD/YYYY'>{projects.endDate}</Moment>
)}
</td>
<td>
<strong>Funding Percent: </strong>
<br />
{projects.fundingPercent}
</td>
</tr>
<tr>
<td>
<strong>Contact: </strong>
{projects.contact}
</td>
</tr>
<tr>
<td>
<strong>Start Date: </strong>
<Moment format='MM/DD/YYYY'>{projects.projectStartDate}</Moment>
</td>
<td>
<strong>End Date: </strong>
{projects.projectEndDate === null ? (
''
) : (
<Moment format='MM/DD/YYYY'>{projects.projectEndDate}</Moment>
)}
</td>
</tr>
<tr>
<td colSpan='5'>
<strong>Goals and Objectives: </strong>
{projects.goalsAndObjectives}
</td>
</tr>
<tr>
<td colSpan='5'>
<strong>Success Description: </strong>
{projects.successDescription}
</td>
</tr>
<tr>
<td>
<strong>Accountable Staff</strong>
<ProjectStaff />
</td>
</tr>
<tr>
<td>
<strong>Project ID: </strong>
{projects.projectId}
</td>
</tr>
</tbody>
</Table>
</div>
<ActivitySummary />
</Fragment>
); };
export default ProjectScreen;
However when I attempt to access the data that is inside the array:
accountableStaff: [
{
lastName: 'Wagner',
firstName: 'Lauren'
},
{
lastName: 'Trenary',
firstName: 'John'
},
{
lastName: 'Lott',
firstName: 'Timothy'
},
{
lastName: 'Chatfield',
firstName: 'Dean'
}
],
I get an error that says 'map' is not a function. I can console.log the data in the array, but when I try to access the data I get an error. I have been struggling with this for DAYS!!