Last active
July 31, 2017 23:02
-
-
Save toy-crane/f74e0e977595bc86a52b40f4c0f60e23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The wrong is in the line 15 you code would must this:
YTsearch({key: API_KEY, term:'hello'}, (data) => {