var React = require('react');
var shallowEqual = require('react/lib/shallowEqual');
var cloneWithProps = require('react/lib/cloneWithProps');
var Ladda = require('ladda/dist/ladda.min');

var LaddaButton = React.createClass({
  displayName: 'LaddaButton',

  propTypes: {
    active: React.PropTypes.bool,
    progress: React.PropTypes.number,
    style: React.PropTypes.string,
    color: React.PropTypes.string,
    size: React.PropTypes.string,
    spinnerSize: React.PropTypes.number,
    spinnerColor: React.PropTypes.string,
    children: React.PropTypes.node.isRequired
  },

  getDefaultProps: function() {
    return { style: 'expand-left' };
  },

  componentDidMount: function() {
    this.laddaButton = Ladda.create(this.getDOMNode());
  },

  componentWillUnmount: function() {
    if (this.laddaButton.remove) {
      this.laddaButton.remove();
    }
  },

  shouldComponentUpdate: function(nextProps, nextState) {
    return !shallowEqual(this.props, nextProps);
  },

  componentDidUpdate: function() {
    if (this.props.active) {
      if (!this.active) {
        this.active = true;
        this.laddaButton.start();
      }
    } else {
      this.active = false;
      this.laddaButton.stop();
    }
    if (this.props.progress) {
      this.laddaButton.setProgress(this.props.progress);
    }
  },

  render: function() {
    var props = {className: 'ladda-button'};
    var laddaOptions = {
      style: 'data-style',
      color: 'data-color',
      size: 'data-size',
      spinnerSize: 'data-spinner-size',
      spinnerColor: 'data-spinner-color'
    };

    for (var prop in laddaOptions) {
      var dataAttr = laddaOptions[prop];
      if (this.props[prop]) {
        props[dataAttr] = this.props[prop];
      }
    }

    return cloneWithProps(this.props.children, props);
  }
});

module.exports = LaddaButton;

@@ -31,114 +31,130 @@
 var 
-shallowEqual = require('react/lib/shallowEqual');%0Avar cloneWithProps = require('react/lib/cloneWithProps')
+cloneWithProps = require('react/lib/cloneWithProps');%0Avar PureRenderMixin = require('react/addons').addons.PureRenderMixin
 ;%0Ava
@@ -264,16 +264,45 @@
 Button',
+%0A  mixins: %5BPureRenderMixin%5D,
 %0A%0A  prop
@@ -603,11 +603,17 @@
 pes.
-nod
+renderabl
 e.is
@@ -921,23 +921,17 @@
 %0A%0A  
-shouldC
+c
 omponent
 Upda
@@ -926,16 +926,19 @@
 omponent
+Did
 Update: 
@@ -950,121 +950,61 @@
 ion(
-nextProps, nextState) %7B%0A    return !shallowEqual(this.props, nextProps);%0A  %7D,%0A%0A  componentDidUpdate: function() %7B
+) %7B%0A    if (!this.laddaButton) %7B%0A      return;%0A    %7D%0A
 %0A   

Check for DOM node to exist