I am trying to create a condition statement for the url that the user would click,
what i want to do is this, check if the message.sender.id === user_id
, then i want to change the url to ${/inbox/}${message.reciever.id}${"/"}
and if the message.sender.id !=== user_id
i need url to be ${/inbox/}${message.sender.id}${"/"}
i don't know the best way to do this becuase the url is supposed to be in a map
{
message.map((message) => (
<Link className="chat-contacts-item" to={message.sender.id === user_id && `${/inbox/}${message.reciever.id}${"/"}`}>
<p className="float-left">{message.message}</p>
</Link>
)
)}
<Link className="chat-contacts-item" to={message.sender.id === user_id &&`${/inbox/}${ message.reciever.id}${'/'}`}>
Click Now
</Link>
This is the one I wrote, how to write else statement here
{message.sender.id === user_id &&
`${/inbox/}${ message.reciever.id}${'/'}`
}