0

Can anyone shed some light on the notice I am getting back from 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

AymDev
  • 6,626
  • 4
  • 29
  • 52
Simon F
  • 3
  • 1
  • 2

1 Answers1

0

In JavaScript, class cannot be defined as static. 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.

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
  • 1
    Many thanks @BhojendraRauniyar I was trying to use the `static class feature` thats currently in proposal state. Updated to the following and my warnings are now gone. `export default class foreignDataFormat extends _base {} foreignDataFormat.input = class ForeignDataFormatInput extends React.Component { render () { } }` – Simon F Sep 06 '18 at 11:38