How to use the react-tools.React.createClass function in react-tools

To help you get started, we’ve selected a few react-tools 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 react-cosmos / react-cosmos / fresh-bundle.js View on Github external
Fresh.mixins.SetInterval = {
  componentWillMount: function() {
    this.intervals = [];
  },
  setInterval: function() {
    this.intervals.push(setInterval.apply(null, arguments));
  },
  componentWillUnmount: function() {
    this.intervals.map(clearInterval);
  }
};

/** @jsx React.DOM */

Fresh.components.Author = React.createClass({
  /**
   * Input: {
   *   component: 'Author',
   *   name: 'Dan Ciotu'
   * }
   */
  mixins: [Fresh.mixins.SetInterval,
           Fresh.mixins.PersistState,
           Fresh.mixins.DataManager],
  render: function() {
    return (
      React.DOM.div(null, this.state.data.name)
    );
  }
});
github react-cosmos / react-cosmos / fresh-bundle.js View on Github external
*   name: 'Dan Ciotu'
   * }
   */
  mixins: [Fresh.mixins.SetInterval,
           Fresh.mixins.PersistState,
           Fresh.mixins.DataManager],
  render: function() {
    return (
      React.DOM.div(null, this.state.data.name)
    );
  }
});

/** @jsx React.DOM */

Fresh.components.List = React.createClass({
  /**
   * Input: {
   *   component: 'List',
   *   data: 'http://localhost/static/users.json'
   * }
   */
  mixins: [Fresh.mixins.SetInterval,
           Fresh.mixins.PersistState,
           Fresh.mixins.DataManager],
  getInitialState: function() {
    return {data: []};
  },
  render: function() {
    return (
      React.DOM.ul( {className:"List"}, 
        this.state.data.map(function(item, index) {