React.component error solution: 1. Open the corresponding react file, look for the "class Counter extends Component {static propTypes = {..." statement, and change the equal sign to a colon; 2. Modify " { "presets": ["react", "es2015", "stage-0"]}" is enough.
The operating environment of this tutorial: Windows10 system, react18 version, Dell G3 computer.
What should I do if the react.component error is reported?
react component syntax error resolution
React es6 syntax
class Counter extends Component { static propTypes = {
Error report.
Two solutions:
1. Change the equal sign to a colon, but it looks awkward
2.yarn add babel-preset-stage- 0
{ "presets": ["react", "es2015", "stage-0"] }
Recommended learning: "react video tutorial"
The above is the detailed content of What to do if react.component reports an error. For more information, please follow other related articles on the PHP Chinese website!