When I create a react project using Vite, I encounter the following error when defining a prop. If I don’t have this problem with create React App, why does this error occur? Maybe I have not installed a module?
When I create a react project using Vite, I encounter the following error when defining a prop. If I don’t have this problem with create React App, why does this error occur? Maybe I have not installed a module?
2
Answers
check this link, you need to create proptypes for component
logrocket
This error is from
eslint
react/prop-types
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md. Seems like creating a react app with vite adds this rule to the eslint config.You can disable it by oppening
.eslintrc.cjs
file in the root directory of your app and adding a rule with0
–"react/prop-types": 0
.Or if it is already included in the rules with value
1
or2
, you can remove that line.