Next.js Discord

Discord Forum

react errors BEGINNER

Answered
bobonlan posted this in #help-forum
Open in Discord
Avatar
bobonlanOP
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
bobonlanOP
Image
Avatar
joulev
Can you show the ListGroup.tsx file
Avatar
bobonlanOP
ye
Image
Avatar
joulev
Hmm it looks fine to me :thinkies: what happens if you move the items array outside the ListGroup component
Avatar
bobonlanOP
I'm not sure how to do that
im sorry im embarassingly new
Avatar
joulev
let items = […]

function ListGroup() {
…
}
Avatar
bobonlanOP
oh
Avatar
joulev
If it doesn’t work then can you make a code sandbox or something
Avatar
joulev
Because your code above looks fine to me
Answer
Avatar
bobonlanOP
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
joulev
I think it’s strange as well, keys are strings so it should work
Avatar
bobonlanOP
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