From aaf7ff6426b84e643855798d336dff41db796996 Mon Sep 17 00:00:00 2001 From: macdja38 Date: Thu, 25 Oct 2018 20:57:27 -0400 Subject: [PATCH] Implement should update --- src/widgets/CountryTable.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/widgets/CountryTable.js b/src/widgets/CountryTable.js index b1df7db..2a18dad 100644 --- a/src/widgets/CountryTable.js +++ b/src/widgets/CountryTable.js @@ -27,7 +27,6 @@ export default class Template extends Component { constructor(props) { super(props); - this.state = {}; } componentDidMount() { @@ -63,6 +62,17 @@ export default class Template extends Component { }); } + shouldComponentUpdate(nextProps) { + const { props } = this; + + return Object.keys(this.props).reduce((acc, key) => { + if (props[key] !== nextProps[key]) { + return acc && false; + } + return acc; + }, true); + } + render() { if (this.viz != null) { this.viz.show(this.ref);