case 1) I am trying to conditionally render using map and a ternary operator. Here I am iterating over an array of objects and then render only first six of them. Trying to achieve the same, but it does not seem like working.
Help would be appreciated
OBJECT
const recentEventsData = [
{ key: "01", text: "AAA", timestamp: "11:52:27:02 02-11-2019" },
{ key: "02", text: "BBB", timestamp: "11:52:29:02 02-11-2019" },
{ key: "03", text: "CCC", timestamp: "11:52:30:02 02-11-2019" }
];
Inside render()
{
recentEventsData.map((data, index) => {
{
index < 6 ? (
<div key={index}>
//Want the transformed output here , that is fourth value from object
<p>{data.text}</p>
<p>{data.timestamp}</p>
<hr />
</div>
) : null;
}
});
}