skip to Main Content

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?

enter image description here

2

Answers


  1. check this link, you need to create proptypes for component
    logrocket

    Login or Signup to reply.
  2. 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 with 0"react/prop-types": 0.

    Or if it is already included in the rules with value 1 or 2, you can remove that line.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search