forked from AdaGold/video-store-consumer
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathApp.js
27 lines (22 loc) · 823 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
import React, { useState } from 'react';
import { BrowserRouter as Router, Link, Route} from 'react-router-dom';
import './App.css';
import Videos from './components/Videos';
import Customers from './components/Customers'
const App = () => {
const [selectedVideo, setSelectedVideo] = useState('');
const setVideo = (videoTitle) => {
setSelectedVideo(videoTitle)
}
return (
<Router>
<Link to='/'>Home</Link>
<Link to='/customers'>Customers</Link>
<Link to='/library'>Videos</Link>
<Route path='/' render={() => selectedVideo} />
<Route path='/customers' component={() => <Customers url='http://localhost:3000' />}/>
<Route path='/library' component={() => <Videos url='http://localhost:3000' onClickCallback={setVideo}/>}/>
</Router>
);
}
export default App;