ultimate-react-course icon indicating copy to clipboard operation
ultimate-react-course copied to clipboard

PropType validation error in CityList.jsx and CityItem.jsx in WorldWise project

Open Aditya-Ghosh-27 opened this issue 11 months ago • 2 comments

If you are following and coding along, you might have come across this error yourself as well, i.e in the Implementing the Cities video. When you try to pass the city prop to the CityItem.jsx component then you might have come up with this error where it is asking to specify the types of prop that you are passing.

country' is missing in props validation react/prop-types 7:22 error 'country.emoji' is missing in props validation react/prop-types 8:22 error 'country.emoji' is missing in props validation react/prop-types

It is turning out to be like this and for the time being, I have added prop types for each props being passed. If anyone has succesfully resolve this error. Please do leave any resources/ comment that could help me.

Thanks and regards

Aditya-Ghosh-27 avatar Feb 26 '24 17:02 Aditya-Ghosh-27

Hey there, Yes in vite, normally eslint's react rules are strict when it comes to prop validation, you can turn it off by doing the following.

  1. Go to your eslint config file.
  2. Search for the rules object.
  3. Under it, write the following: react/prop-types: false

Let me know if it worked for you!

yonathandevpro avatar Sep 03 '24 13:09 yonathandevpro

You can simply ignore that warning by adding the "react/prop-types": "off" to the end of the rules Object inside your eslint config file image image

hoapooh avatar Sep 04 '24 18:09 hoapooh

3. react/prop-types: false

please it's doesn't work for me i dont know maybe you have any other solution

Areolaadeleke avatar Oct 26 '24 11:10 Areolaadeleke