Skip to content

Commit

Permalink
Merge pull request #22 from crux153/master
Browse files Browse the repository at this point in the history
Update on className change
  • Loading branch information
capaj authored Jun 12, 2018
2 parents c372b91 + f9f8ed2 commit 4cb3612
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 4cb3612

Please sign in to comment.