I have a map function which maps an array object of users with attributes fullname and points. Is there a way I can somehow add the points of every user whilst it maps and store it in a variable. I tried several ways with useState (in react), but I kept getting re-render error.
{users.map((user, index) => { return (
<tr key={index}>
<td>{user.fullname}</td>
<td>{user.points}</td>
</tr>
); })}
Any help would be appreciated..