Home >Web Front-end >Front-end Q&A >What to do if react.component reports an error

What to do if react.component reports an error

藏色散人
藏色散人Original
2022-12-20 10:49:561860browse

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.

What to do if react.component reports an error

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn