27 lines
658 B
JavaScript
27 lines
658 B
JavaScript
import React from 'react'
|
|
import SearchBar from './SearchBar'
|
|
import youtube from '../apis/youtube'
|
|
|
|
class App extends React.Component {
|
|
state = { videos: [] }
|
|
onTermSubmit = async (term) => {
|
|
const response = await youtube.get('/search', {
|
|
params: {
|
|
q: term,
|
|
}
|
|
})
|
|
|
|
this.setState({ videos: response.data.items })
|
|
}
|
|
|
|
|
|
render() {
|
|
return <div className="ui container">
|
|
<SearchBar onFormSubmit={this.onTermSubmit} />
|
|
<p>I have: {this.state.videos.length} videos</p>
|
|
<p>Testing a minial theme</p>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
export default App |