1: Source of information https://www.npmjs.com/package/prop-types uses third-party prop-types to process props to make props appear to have data type constraints (js is the probability of weak language without data types)
2: install
npm install --save prop-types
3: Use to introduce where it is needed (Header.js)
4: do a test
I will pass a number to the Header in index.js and try to rewrite the code in index.js as follows. You can also write useage={18}
5: The result of running the code will not be wrong, the page effect will come out, but the console will report an error
6: Change to
static propTypes={
useage:PropTypes.number
}
The error will go away