Struggling with a React issue and seeking help. I've been following a tutorial on YouTube, working in CodeSandbox. Whenever I click the button, an error pops up. Can anyone assist me in resolving this? Here is a snippet of my code:
return (
<>
{/* {JSON.stringify(pressedNumbers)} */}
<div>
{error}
{isCorrrect ? (
<div>success!</div>
) : (
<div className="number-pad">
{numbers.map((number, idx) => (
// ...cur needs to be array of numbers
// idx we don't do any sorting on the array
<button
key={idx}
onClick={(cur) => setPressedNumbers(...cur, number)}
>
{number}
</button>
))}
</div>
)}
</div>
</>
);