Skip to content

Commit

Permalink
react-addons-shallow-compare
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Dec 13, 2016
1 parent b1c2c12 commit 1bedf89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"d3-scale": "^1.0.4",
"d3-selection": "^1.0.3",
"d3-shape": "^1.0.4",
"d3-timer": "^1.0.3"
"d3-timer": "^1.0.3",
"react-addons-shallow-compare": "^0.14.0 || ^15.0.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
Expand Down
4 changes: 4 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import shallowCompare from 'react-addons-shallow-compare';
import { timer } from 'd3-timer';
import { arc, area } from 'd3-shape';
import * as ease from 'd3-ease';
Expand Down Expand Up @@ -111,6 +112,9 @@ class LiquidFillGauge extends Component {
}
this.draw();
}
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
setRes() {
const width = (this.props.width * this.props.innerRadius) / 2;
const height = (this.props.height * (this.props.innerRadius - this.props.margin)) / 2;
Expand Down

0 comments on commit 1bedf89

Please sign in to comment.