I am new in ReactJs. I have code below:
{users.map((user, index) => (
<tr key={user.id}>
<td>{ index+1 }</td>
<td>{user.name}</td>
<td>{user.email}</td>
<td>{user.gender}</td>
<td>{user.status}</td>
</tr>
))}
My question is how to add if condition in the code, e.g:
if (user.status) == "0"
return "In-Active"
else if (user.status) == "1"
return "Active"
else if (user.status) == "2"
return "Disabled"
let statusTexts = { "0": "In-Active", "1": "Active", "2": "Disabled" }, then can render as<td>{statusTexts[user.status]}</td>