prop-types icon indicating copy to clipboard operation
prop-types copied to clipboard

Typo in static class property declaration react/no-typos

Open shmatapour opened this issue 7 years ago • 19 comments

Hi guys, I installed PropTypes and used it on my project , I encountered with below error : err

Please guide me how to solve it if you know, Thanks.

shmatapour avatar Mar 18 '19 06:03 shmatapour

it's .propTypes, not .PropTypes. The rule just saved you from a bug.

ljharb avatar Mar 18 '19 06:03 ljharb

same problem occured to me please help me but i gave .propTypes this only.i new to react Thanks in Advance

abid102 avatar Aug 14 '19 11:08 abid102

@abid102 please file a new issue.

ljharb avatar Aug 14 '19 14:08 ljharb

Please, anyone, suggest the answer because I am also facing the same problem

maniranganathan97 avatar Nov 19 '19 12:11 maniranganathan97

I found the Answer propTypes and not proptypes

Happy Coding!!!!!!

maniranganathan97 avatar Nov 19 '19 12:11 maniranganathan97

I had the same issue, the bug is from the naming convention. .propTypes not .PropTypes. Thank You ljharb.

Danielchucks avatar Dec 17 '19 21:12 Danielchucks

Thank you ljharb.

juancolchete avatar Dec 26 '19 23:12 juancolchete

Thanks, This also worked for me.

thobishi avatar Jan 03 '20 10:01 thobishi

Thank you ljharb.

yogesh1008 avatar Jan 08 '20 17:01 yogesh1008

Thanks, This also worked for me.

yogesh1008 avatar Jan 08 '20 17:01 yogesh1008

import propTypes from 'prop-types';

and use propTypes as @ljharb said it worked ❤🐱‍💻

krishnadevz avatar Mar 18 '20 16:03 krishnadevz

thanks it worked..

classyeze avatar Apr 05 '20 19:04 classyeze

import propTypes from 'prop-types';

and use propTypes as @ljharb said it worked ❤🐱‍💻

Actually you can follow the docs.

import PropTypes from 'prop-types';

and then

Component.propTypes = {
  myProp: PropTypes.array.isRequired
}

It's Component.propTypes not Component.PropTypes

Yes... I know... 🙄

jorgearimitsu avatar Apr 14 '20 17:04 jorgearimitsu

.propTypes worked for me instead of .PropTypes

omfuke avatar May 11 '20 09:05 omfuke

keep import as

 import PropTypes from 'prop-types';

and then to add a property to component use

Todos.propTypes = {}

This has worked for me. See the cases of proptypes in both the places

virtuousved avatar Jun 05 '20 13:06 virtuousved

import PropTypes from 'prop-types';

Todos.propTypes = {
// your code
};

gnsalok avatar Aug 27 '20 11:08 gnsalok

@ljharb whats the difference between .propTypes and .PropTypes ? i need ans man, can't sleep without knowing

peepsenpai avatar Aug 13 '21 16:08 peepsenpai

@peepsenpai one starts with a lowercase P and the other starts with a capital P, and only one of them is correct. Get some rest!

ljharb avatar Aug 13 '21 16:08 ljharb

image do this Component.propTypes={ props:PropTypes.string};

Krishna-sm avatar May 19 '22 13:05 Krishna-sm