Next.js Discord

Discord Forum

react errors BEGINNER

Answered
bobonlan posted this in #help-forum
Open in Discord
Avatar
following along with a mosh course and getting some errors but don't understand why, any insight would be helpful.
Answered by joulev
Because your code above looks fine to me
View full answer

19 Replies

Avatar
Image
Avatar
Can you show the ListGroup.tsx file
Avatar
ye
Image
Avatar
Hmm it looks fine to me :thinkies: what happens if you move the items array outside the ListGroup component
Avatar
I'm not sure how to do that
im sorry im embarassingly new
Avatar
let items = […]

function ListGroup() {
…
}
Avatar
oh
Avatar
If it doesn’t work then can you make a code sandbox or something
Avatar
Because your code above looks fine to me
Answer
Avatar
that fixed it
i just don't understand, usually bugs make sense logically
at least in my experience every "bug" has been some sort of fuck up on my part or not knowing thers better ways to code
Avatar
I think it’s strange as well, keys are strings so it should work
Avatar
i went along with the next step and it's giving more errors after adding an onClick event to the <li>
The onClick event is working though
Image
nvm refresh fixed it, and 10 seconds later they address that error