Начал учить Реакт
Не рендерит почему то...
не вижу ошибку
или вообще...в чем ну правильный ход мысли?
var TextInput = React.createClass({
getInitialState: function(){
text: ''
},
handleVal: function(e){
this.setState({text: e.target.value})
},
render: function(){
return (
<input value={this.state.text} onChange={this.handleVal} required />
)
}
});
var RegForm = React.createClass({
newUser: function(e) {
$.ajax({
url: 'ajax/path',
method: 'post',
dataType: 'json',
data: {
login: this.state.login,
email: this.state.email,
pass: this.state.pass,
rep_pass: this.state.rep_pass
},
success: function(data) {
this.setState({
login: '',
email: '',
pass: '',
rep_pass: ''
});
}.bind(this)
});
},
render: function() {
return (
<form className="regForm">
<TextInput
name="login"
id="login"
type="text"
placeholder="Login"
minLength="3" />
<TextInput
name="email"
id="email"
type="email"
placeholder="Email"
className="validate" />
<TextInput
name="pass"
id="pass"
type="password"
placeholder="Password" />
<TextInput
name="rep_pass"
id="rep_pass"
type="password"
placeholder="Repeat password" />
<input type="submit" className="waves-effect waves-light btn green accent-4" value="Registration" />
</form>
);
}
});
ReactDOM.render(
<RegForm />,
document.getElementById('reg_form')
);