Answer the question
In order to leave comments, you need to log in
How to use the prop-types package?
I install packages
"react": "^0.14.7",
"react-dom": "^0.14.7",
"prop-types": "^15.5.10",
"react-popup": "^0.8.0"
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Popup from 'react-popup';
ReactDOM.render(<Popup />, document.getElementById('react-popup'));
Warning: Failed propType:
Calling PropTypes validators directly is not supported by the `prop-types` package.
Use `PropTypes.checkPropTypes()` to call them.
Answer the question
In order to leave comments, you need to log in
Most likely, the warning is that you write React.PropTypes...
A should be simple PropTypes...
. For example:
import React, { Component } from 'react'
import { PropTypes } from 'prop-types' // можно и import PropTypes from 'prop-types'
...
ComputersList.propTypes = {
data: PropTypes.shape({
rows: PropTypes.array.isRequired,
isFetching: PropTypes.bool.isRequired,
}).isRequired,
onlineSessions: PropTypes.array.isRequired,
onChangeSort: PropTypes.func.isRequired,
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question