Closed shmatapour closed 5 years ago
it's .propTypes
, not .PropTypes
. The rule just saved you from a bug.
same problem occured to me please help me but i gave .propTypes this only.i new to react Thanks in Advance
@abid102 please file a new issue.
Please, anyone, suggest the answer because I am also facing the same problem
I found the Answer propTypes and not proptypes
Happy Coding!!!!!!
I had the same issue, the bug is from the naming convention. .propTypes
not .PropTypes
. Thank You ljharb.
Thank you ljharb.
Thanks, This also worked for me.
Thank you ljharb.
Thanks, This also worked for me.
import propTypes from 'prop-types';
and use propTypes as @ljharb said it worked ❤🐱💻
thanks it worked..
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... 🙄
.propTypes worked for me instead of .PropTypes
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
import PropTypes from 'prop-types';
Todos.propTypes = {
// your code
};
@ljharb whats the difference between .propTypes and .PropTypes ? i need ans man, can't sleep without knowing
@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!
do this Component.propTypes={ props:PropTypes.string};
Hi guys, I installed PropTypes and used it on my project , I encountered with below error :
Please guide me how to solve it if you know, Thanks.