var Dot = React.createClass({ mixins: [ChartAnimationMixin], getInitialState: function() { return {}; }, componentWillReceiveProps: function(newProps) { this.setState({ lastY: this.props.y || newProps.y }, this.animateAll); }, animateAll: function() { this.clearAnimations(this.refs.dot); this.animate(this.refs.dot, 'cy', this.state.lastY, this.props.y); }, render: function() { var radius, val = ''+ this.props.value; if (val.length === 1) { radius = 8; } else if (val.length === 2) { radius = 9; } else { radius = 11; } return ( {this.props.value} ); } });