Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: babel rejects class properties #156

Open
fabdrol opened this issue Oct 2, 2018 · 0 comments
Open

Bug: babel rejects class properties #156

fabdrol opened this issue Oct 2, 2018 · 0 comments

Comments

@fabdrol
Copy link

fabdrol commented Oct 2, 2018

I have a react component which looks like this:

class SignIn extends React.Component {
  state = {
    username: '',
    password: '',
    remember: false
  }

  usernameChange = (e) => {
    this.setState({ username: e.target.value })
  }

  passwordChange = (e) => {
    this.setState({ password: e.target.value })
  }

  render () { /* ... */ }
}

The included babel parser causes a compile error:

Failed to compile.

./src/components/login/login.js
  Line 57:  'state' is not defined           no-undef
  Line 63:  'usernameChange' is not defined  no-undef
  Line 67:  'passwordChange' is not defined  no-undef

Search for the keywords to learn more about each error

I'm having trouble figuring out what's going wrong here. My env file:

REACT_APP_DECORATORS = true
REACT_APP_BABEL_STAGE_0 = true

REACT_APP_SASS = false
REACT_APP_LESS = false
REACT_APP_STYLUS = true

REACT_APP_CSS_MODULES = true
REACT_APP_SASS_MODULES = false
REACT_APP_STYLUS_MODULES = true
REACT_APP_LESS_MODULES = false
REACT_APP_WEBPACK_DASHBOARD = false

# CSS Module hash
# REACT_APP_CSS_MODULE_CLASSNAME_TEMPLATE = 'module-[sha512:hash:base32]-[name]-[local]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant