Ответ 1
Извлечен из блога Reacts - npm install prop-types, затем используйте новый код. Также он сказал, что вы можете получить это сообщение об ошибке, если вложенный компонент не использует prop-типы, но родительский - поэтому вам нужно проверить другие компоненты.
// Before (15.4 and below)
import React from 'react';
class Component extends React.Component {
render() {
return <div>{this.props.text}</div>;
}
}
Component.propTypes = {
text: React.PropTypes.string.isRequired,
}
// After (15.5)
import React from 'react';
import PropTypes from 'prop-types';
class Component extends React.Component {
render() {
return <div>{this.props.text}</div>;
}
}
Component.propTypes = {
text: PropTypes.string.isRequired,
};