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

藏色散人
Release: 2022-12-20 10:49:56
Original
1863 people have browsed it

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 = {
Copy after login

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"]
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template