Skip to content
RED SAGSkills
hard20 pts · first answer countsreactstaterendering

Too many re-renders error

Why does this crash with "Too many re-renders"?

function Price({ amount }) {
  const [total, setTotal] = useState(0)
  setTotal(amount * 1.18)
  return <p>{total}</p>
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions