-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathapp.js
38 lines (33 loc) · 993 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import ReactDOM from 'react-dom';
import { Video } from './Video';
import { Menu } from './Menu';
const VIDEOS = {
fast: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_video-fast.mp4',
slow: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_video-slow.mp4',
cute: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_video-cute.mp4',
eek: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_video-eek.mp4'
};
class App extends React.Component {
constructor(props) {
super(props);
this.chooseVideo = this.chooseVideo.bind(this);
this.state = { src: VIDEOS.fast };
}
chooseVideo(newVideo) {
this.setState({src: VIDEOS[newVideo]})
}
render() {
return (
<div>
<h1>Video Player</h1>
<Menu chooseVideo={this.chooseVideo}/>
<Video src={this.state.src}/>
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('app')
);