Skip to content

Instantly share code, notes, and snippets.

@saposki saposki/index.js
Created Nov 22, 2016

What would you like to do?
pair programming
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import YTSearch from 'youtube-api-search';
import SearchBar from './components/search_bar';
import VideoList from './components/video_list';
const API_KEY = 'AIzaSyA3EACxxpvIrSqD355X1tKVu0PrmCg05mM';
YTSearch({key: API_KEY, term: 'surfboards'}, function(data){
// Create a new component. This component should produce
//some HTML
class App extends Component {
this.state = { video: [] };
YTSearch({key: API_KEY, term: 'surfboards'}, (videos) => {
this.setState({ videos });
// this.setState({ videos: videos})
return (
<SearchBar />
<VideoList videos={this.state.videos} />
// Take this component's generaed HTML and put it on the page (in the DOM)
ReactDOM.render(<App />, document.querySelector('.container'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.