I am getting map inside an array in redux store from spring controller. And i want to map through that array. but its giving me error TypeError: project_tasks.map is not a function
.
I can see map inside state but i am not able to map through that array. How can i do this please help me i am new to react.
this is my store
mobile.js
let mobile = [];
const mobiletasks = project_tasks.map((project_task, index) => (
<mobileItems key={project_task.viewproducts3.id} project_task={project_task} />
));
mobile.push(mobiletasks);
mobileItems.js
import React, { Component } from 'react'
class mobileItems extends Component {
render() {
const { project_task } = this.props;
return (
<div class="row mx-auto" style="background-color: white;">
<div class="col-lg-2 col-md-6 mb-4">
<a href="" style="text-decoration: none;" id="">
<div class="card h-100">
<img src="" alt="" class="card-img-top zoom mt-2"/>
<div class="card-body text-center">
<h5 class="titlename text-truncate">project_task.name</h5>
<div class="caption">
<h5 class="pull-right productprice">₹</h5>
</div>
</div>
</div>
</a>
</div>
</div>
);
}
}
export default mobileItems;
Please tell me what am i doing wrong here?