Yoctol / react-d3-cloud

A word cloud react component built with d3-cloud.
https://yoctol.github.io/react-d3-cloud
MIT License
142 stars 47 forks source link

Prevent Re-render on component will receive props #72

Closed rizkiandrianto closed 7 years ago

rizkiandrianto commented 7 years ago

Did you know how to prevent re-render wordcloud when receive props?

rizkiandrianto commented 7 years ago

Never mind, I added this script :

shouldComponentUpdate(nextProps, nextState) {
    if (nextProps.data != this.props.data && nextState.data !== this.state.data) {
      return true;
    }
    return false;
  }