question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use with ES6 classes?

See original GitHub issue

I’m trying to use Formsy like so:

import React, {Component} from 'react';
import Formsy from 'formsy-react';
import reactMixin from 'react-mixin';

export default class TestInput extends Component {
  changeValue(event) {
    this.setValue(event.target.value);
  }

  render() {
    return <div>
      <input
        type="text"
        onChange={this.changeValue.bind(this)}
        value={this.getValue()}
      />
    </div>
  }
}

reactMixin(TestInput.prototype, Formsy.Mixin);

And I’m getting this error, along with a couple other similar ones:

Warning: getInitialState was defined on TestInput, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?

Do I simply have to use React.createClass?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
FutureKodecommented, Feb 24, 2016
0reactions
simondellcommented, Nov 15, 2017

@apuntovanini Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript ES6 Classes - Method cant access class property ...
In JavaScript, as for now, instance properties can only being defined inside class methods using keyword this (here is the doc).
Read more >
Classes - JavaScript - MDN Web Docs
Classes are a template for creating objects. They encapsulate data with code to work on that data. Classes in JS are built on...
Read more >
As a JS Developer, This Is What Keeps Me Up at Night - Toptal
The answer here is there isn't one. These do effectively the same thing, it's only a question of whether ES6 class syntax was...
Read more >
Please stop using classes in JavaScript - everyday.codes
In this article I will talk about why it is a bad idea to use classes in JavaScript, and what are some of...
Read more >
Can't use ES6 class as View · Issue #194 - GitHub
ES6 classes are technically not difficult to support* in domvm. they actually were supported at one point. however, domvm intentionally avoids ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found