react-loading-status-mixin
get the loading status of the component tree
Last updated 6 years ago by camshaft .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-loading-status-mixin 
SYNC missed versions from official npm registry.

react-loading-status-mixin

get the loading status of the component tree

Usage

var LoadingStatusMixin = require('react-loading-status-mixin');

React.createClass({
  mixins: [LoadingStatusMixin],
  componentWillMount: function() {
    var self = this;
    request.get('/api', function(res) {
      self.setState({data: res});

      // tell the mixin the component has loaded its data
      self.setIsLoaded(true);
    });
  },
  render: function() {
    // compute the className based on the loaded status
    var className = this.isLoaded() ? 'loaded' : 'loading';

    return (
      React.DOM.div({className: className})
    );
  }
});

API

setIsLoaded(isLoaded)

Set the loaded status for the component

isLoaded()

Get the loaded status for the component, including all of the children

Current Tags

  • 0.1.3                                ...           latest (6 years ago)

4 Versions

  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |