Can't use with ES6 classes?
See original GitHub issueI’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:
- Created 8 years ago
- Reactions:1
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For use with es6 I think you can use this https://github.com/christianalfoni/formsy-react/blob/master/API.md#formsyhoc
@apuntovanini Thanks!