I am evaluating react.js and seems like it is quite slow compared to angular.js
Here is a problem with 1000 input fields with React:
var Message = React.createClass({
render: function () {
return this.transferPropsTo(
<input type="text" value={this.props.text} onChange={this.props.callback}/>)
}
});
var MessagesApp = React.createClass({
getInitialState: function () {
return { text: "hello"}
},
textChange: function (event) {
this.setState({text: event.target.value})
},
createDom: function () {
var dom = []
for (var i = 0; i < 1000; i++) {
dom.push(<li>
<Message key={i} text={this.state.text} callback={this.textChange} />
</li>)
}
return dom
},
render: function () {
return (<ul>
{this.createDom()}
</ul>)
}
});
React.renderComponent(<MessagesApp/>, document.body);
Here is same with AngularJS:
And this one with Backbone + React:
Is there some way to improve React performance?
shouldComponentUpdatein your components to prevent unneeded rendering.