i have a json file containing array of object such that:
[
{
"id": 1,
"title": "first title",
"description":"first descript",
"image":"/assets/Images/myimage-1.jpg"
},
{
"id": 2,
"title": "second title",
"description":"second descript",
"image":"/assets/Images/second.jpg"
},
]
i have the following function in jsx
export default function myfunc({task}) {
return (
<ul>
{tasks.map(task => <div key={task.id} >{task.title}{task.description}</div> )} ;
{tasks.map(task => <img src={task.image} key={task.id}></img> )}
</ul>
)
}
which when executed parses the text content first then the image content, due to the need for img tag how can i make it so that it is parsing the image source and text in one go using map? while being able to assign classes to them?
i found a similar question from years ago but that one is unanswered as well. React dynamic mapping image paths from json