import React from 'react';
import Chartist from 'chartist';

export default class Chart extends React.Component {
  componentDidMount() {
    this.updateChart(this.props);
  }

  componentWillReceiveProps(newProps) {
    this.updateChart(newProps);
  }

  componentWillUnmount() {
    this.chartist && this.chartist.detach();
  }

  render() {
    return <div className = "ct-chart"></div>;
  }

  updateChart(configs) {
    const {type, data, options = {}, responsiveOptions = []} = configs;

    data.series && (this.chartist = new Chartist[type](React.findDOMNode(this), data, options, responsiveOptions));
  }
}

@@ -609,8 +609,196 @@
 ;%0A  %7D%0A%7D%0A
+%0AChart.propTypes = %7B%0A  type: React.PropTypes.string.isRequired,%0A  data: React.PropTypes.object.isRequired,%0A  options: React.PropTypes.object,%0A  responsiveOptions: React.PropTypes.array%0A%7D;%0A

Add props validation