Skip to content

Commit

Permalink
Update on className change
Browse files Browse the repository at this point in the history
  • Loading branch information
crux153 committed Apr 3, 2018
1 parent c372b91 commit f9f8ed2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tweet-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ class TweetEmbed extends React.Component {
}

shouldComponentUpdate (nextProps, nextState) {
return this.props.id !== nextProps.id
return (
this.props.id !== nextProps.id ||
this.props.className !== nextProps.className
)
}

componentWillUpdate (nextProps, nextState) {
this.loadTweetForProps(nextProps)
if (this.props.id !== nextProps.id) {
this.loadTweetForProps(nextProps)
}
}

render () {
Expand Down

0 comments on commit f9f8ed2

Please sign in to comment.