Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typo in static class property declaration react/no-typos

I created a CRUD app using Redux so, I write code and when export the component I added this line:

AddContact.PropTypes = {
  addContact: PropTypes.func.isRequired
};

export default connect(null, { addContact })(AddContact);

But, It's showing this error

./src/components/contact/AddContact.js
  Line 461:12:  Typo in static class property declaration  react/no-typos
Search for the keywords to learn more about each error.
like image 565
vijay gehlot Avatar asked Jun 04 '20 20:06

vijay gehlot


2 Answers

should be [p with lower key]

AddContact.propTypes

Documentation => https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-typos.md

like image 80
Martín Ramírez Boggio Avatar answered Sep 17 '22 11:09

Martín Ramírez Boggio


The issue is in the casing.

we usually import PropTypes as:

import PropTypes from 'prop-types'

We imported as PropTypes But while using with a React component. we use it with smaller case propTypes . example.

Blog.propTypes = {
  blog: PropTypes.object.isRequired
}
like image 26
Saurav gupta Avatar answered Sep 20 '22 11:09

Saurav gupta