welkin
welkin

Reputation: 37

ReactJS tutorial: does not display the expected unique key warning

I'm new to ReactJS and I'm trying to follow the tutorial here: https://reactjs.org/tutorial/tutorial.html . Everything seems fine except at this step: https://reactjs.org/tutorial/tutorial.html#picking-a-key where it says

For now, we should see a list of the moves that have occurred in the game and a warning that says:

Warning: Each child in an array or iterator should have a unique “key” prop. Check the render method of “Game”.

I've set up my project using create-react-app (following the instructions here: https://reactjs.org/tutorial/tutorial.html#setup-option-2-local-development-environment), did not change any settings, yet for some reason at this step (before a key is added to the li element) when I run "npm start", I don't see the said warning.

I've tried googling for the answer, ironically all the results I've found are people asking how to get rid of this warning, whereas I'm trying to see this warning. Does anyone know what could be happening here?

Thanks in advance!

Upvotes: 0

Views: 39

Answers (1)

devserkan
devserkan

Reputation: 17608

It is a warning coming from React side and you can see it in your browser's developer tool's console as an error. I know it is weird but I think people turn off the warnings and since keys are necessary for React to handle the list items in a stable way, it is shown as an error.

Upvotes: 1

Related Questions