YouTube Data API v3 にアクセスしようとしていますが、React でスクリプトを読み込む方法がわかりません。this.init()
火事ですが、私は得gapi = {}
ます。奇妙なことgapi
に、コンソールに入ると、適切なオブジェクトとして表示されます。
TestPage = React.createClass({
componentDidMount() {
$.getScript("https://apis.google.com/js/client.js", this.handleClientLoad);
},
handleClientLoad(data, textStatus) {
Utils.logObj(data, "data");
Utils.logObj(textStatus, "textStatus");
Utils.logObj(gapi, "gapi");
Utils.logObj(window.gapi, "window.gapi");
},
render() {
return (
<div>This is the test page.</div>
);
}
});