How to use the react-async.createClass function in react-async

To help you get started, we’ve selected a few react-async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github natew / reactor-demo / app / client.jsx View on Github external
/**
 * @jsx React.DOM
 */

var React          = require('react');
var ReactAsync     = require('react-async');
var ReactMount     = require('react/lib/ReactMount');
var ReactBatching  = require('react-raf-batching').inject();
var Router         = require('./mixins/Router');
var Navigator      = require('./mixins/Navigator');
var PageController = require('./mixins/PageController');
var HTMLLayout     = require('./views/layouts/HTML');

var App = ReactAsync.createClass({

  mixins: [Navigator],

  getInitialStateAsync: function(cb) {
    var page = Router.getRoute(this.props.path).page;
    PageController.setState(page, this.props, cb);
  },

  onNavigate: function(path) {
    this.props.path = path;
    this.componentDidMount(); // to react-async
  },

  render: function() {
    return (