adrianmc adrianmc - 1 year ago 121
React JSX Question

Mysterious ESLint Parsing Error

On line 4 of the following code, ESLint is giving me a parsing error saying:

Unexpected token =

I'm wondering why this is the case? The code runs properly. What am I doing wrong?

import { Component, PropTypes } from 'react';

export default class MainApp extends Component {
static propTypes = {
children: PropTypes.any.isRequired

componentWillMount() {

render() {
return (

Answer Source

You cannot have properties inside classes, you can only have methods.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download