I am using React for a web page. In a component, I have a div on the left and an image on the right.
I would like them to alternate depending on whether their id is odd or even.
function Item({ title, text, link, img,id }) {
return (
<div >
<div>
<h3>
{title}
</h3>
<p>{text}</p>
<a href={link}>
text
</a>
</div>
<img src={img} alt={title} />
</div>
);
}