This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| React.createClass({ | |
| // Your Validation Mixin containing methods like: | |
| // isEmpty, minLength, maxLength, isEmail, etc | |
| mixins: [ValidationMixin], | |
| getInitialState: function() { | |
| return { firstName: '', valid: true }; | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| React.createClass({ | |
| getInitialState: function() { | |
| return { firstName: '', valid: true }; | |
| }, | |
| myLinkState: function(key) { | |
| // ReactLink object | |
| return { | |
| value: this.state[key], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| React.createClass({ | |
| getInitialState: function() { | |
| return { firstName: '' }; | |
| }, | |
| myLinkState: function(key) { | |
| // ReactLink object | |
| return { | |
| value: this.state[key], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Require react with addons | |
| var React = require('react/addons'); | |
| React.createClass({ | |
| mixins: [React.addons.LinkedStateMixin], | |
| getInitialState: function() { | |
| firstName: '' | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| React.createClass({ | |
| render: function() { | |
| return ( | |
| <form> | |
| <input type="text" name="uncontrolled" defaultValue="Uncontrolled"/> | |
| </form> | |
| ); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| React.createClass({ | |
| getInitialState: function() { | |
| return { controlled: 'controlled' }; | |
| }, | |
| // Manual 'two-way data binding' | |
| _handleChange: function(se) { | |
| this.setState({ controlled: se.target.value }); | |
| }, |
NewerOlder