Skip to content

Instantly share code, notes, and snippets.

@toy-crane
Last active July 31, 2017 23:02
Show Gist options
  • Select an option

  • Save toy-crane/f74e0e977595bc86a52b40f4c0f60e23 to your computer and use it in GitHub Desktop.

Select an option

Save toy-crane/f74e0e977595bc86a52b40f4c0f60e23 to your computer and use it in GitHub Desktop.
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import YTsearch from 'youtube-api-search';
import About from './components/About';
import Search_bar from './components/search_bar';
const API_KEY ='blablabla';
class App extends React.Component {
constructor(props){
super(props);
this.state = {videos: []};
YTsearch({key: API_KEY, term:'hello'}, function(data){
this.setState({videos: data});
}
);
}
render(){
return (
<div>
<About />
<Search_bar />
</div>
);
}
}
ReactDOM.render(<App />, document.querySelector('.container'))
@albertcito
Copy link
Copy Markdown

The wrong is in the line 15 you code would must this:

YTsearch({key: API_KEY, term:'hello'}, (data) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment