react errors BEGINNER
Answered
bobonlan posted this in #help-forum
bobonlanOP
following along with a mosh course and getting some errors but don't understand why, any insight would be helpful.
19 Replies
bobonlanOP
Can you show the ListGroup.tsx file
bobonlanOP
ye
Hmm it looks fine to me what happens if you move the items array outside the ListGroup component
bobonlanOP
I'm not sure how to do that
im sorry im embarassingly new
let items = […]
function ListGroup() {
…
}
function ListGroup() {
…
}
bobonlanOP
oh
If it doesn’t work then can you make a code sandbox or something
Because your code above looks fine to me
Answer
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
I think it’s strange as well, keys are strings so it should work
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
nvm refresh fixed it, and 10 seconds later they address that error