Awesome
react-worker
install
npm install --save react-worker
usage
on the main thread:
var React = require('react-worker/src/host');
React.render(require('worker!./worker'), document.getElementById('root'));
on the worker:
var React = require('react-worker/src/client');
var App = React.createClass({
getInitialState: function() {
return {
i: 0
};
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 16);
},
componentWillUnmount: function() {
clearInterval(this.interval);
},
tick: function() {
this.setState({
i: this.state.i + 1
});
},
render: function() {
return React.createElement('ul', null, React.createElement('li', null, this.state.i));
}
});
React.render(<App />);
license
BSD-3-Clause