简体   繁体   English

StandardJS和React类导出意外令牌=

[英]StandardJS and React class export Unexpected token =

Can anyone shed some light on the notice I am getting back from StandardJS? 谁能阐明我从StandardJS回来的通知?

Parsing error: Unexpected token = 解析错误:意外的令牌=

Code is as follows: 代码如下:

export default class foreignDataFormat extends _base {
    static input = class ForeignDataFormatInput extends React.Component {
        render () {

        }
    }
}

The error is referring to the second line input = class 错误是指第二行input = class

In JavaScript, class cannot be defined as static. 在JavaScript中,不能将类定义为静态。 But method can be defined as static. 但是方法可以定义为静态的。 You would just define (and probably mean to define) the class like: 您只需要定义(并且可能意味着要定义)这样的类:

export default class foreignDataFormat extends _base {
    const input = class ForeignDataFormatInput extends React.Component {
        static myMethod() { 
          //... my static method
        }
        render () {

        }
    }
}

You may be interested to see this post . 您可能有兴趣看这篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM