I’m trying to access the YouTube Data API v3, but I’m having some trouble figuring out how to load the script in React. handleClientLoad
fires, but I get 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>
);
}
});
```