You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@moledomario The code in the codesandbox doesn't infinite loop for me. Are you sure you've written the onClick() function such that it returns a function?
// this worksconstonClick=(color)=>()=>{setBackgroundColor(color)}// this wouldn'tconstonClick=(color)=>{setBackgroundColor(color)}
Checks
Describe your suggestion
"onClick={onClick(color)}" generates a infinite loop, you need to add an anonimus function, "onClick={() => onClick(color)}"
Path
Foundations, Node / JS
Lesson Url
https://www.theodinproject.com/lessons/node-path-react-new-introduction-to-state
(Optional) Discord Name
No response
(Optional) Additional Comments
No response
The text was updated successfully, but these errors were encountered: