Incorrect use of id function in React
It is incorrect to generate id
directly in the attribute, like this:
const res = prods.map(function(prod) {
return <p key={id()}>
<span>{prod.name}</span>
<span>{prod.cost}</span>
</p>;
});
The reasons for this will become clear to you in the following lessons. For now, just keep in mind that this is wrong and should never be done.