componentDidMount() {
window.twttr = (function (d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = ' https://platform.twitter.com/widgets.js ';
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function (f) {
t._e.push(f);
};
return t;
})(document, 'script', 'twitter-wjs');
twttr.widgets.load()
}
shareOnTwitter = () => { var tweetUrl = ' https://twitter.com/intent/tweet?url= ' + window.location.href; var x = screen.width / 2 - 700 / 2; var y = screen.height / 2 - 450 / 2; var child = window.open(tweetUrl, "popupWindow", "width=600, height=400,left=" + x + ",top=" + y); child.focus(); twttr.ready(function (twttr) { twttr.events.bind('tweet', function () { alert('Tweeted!'); }); }); };
<a onClick={this.shareOnTwitter} // class="twitter-share-button" >Tweet</a>
He agregado widgets de Twitter en componentDidMount pero no entiendo cómo verifico si el usuario tuiteó o no.