-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
58 lines (54 loc) · 2.36 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, {Component} from 'react';
import CharFrequency from './pages/charFrequency';
import DoubleCharFrequency from './pages/PairFrequency';
import VowelVSConsonant from './pages/vowelVSconsonant';
import Home from './pages/home';
import { BrowserRouter as Router, Route, Switch, Link } from 'react-router-dom';
import './css/navbar.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {fileData: ''};
this.getFileData = this.getFileData.bind(this);
}
getFileData = (data) => {
this.setState({fileData: data});
}
render = () => {
return (
<Router className='App'>
<div>
<ul className='navbarContainer'>
<li className='nav-link'>
<Link to={{ pathname: '/home', data: {sendFileData: this.getFileData} }}>
<p className='link-text '>Home</p>
</Link>
</li>
<li className='nav-link'>
<Link to={{ pathname: '/charFrequency', data: {fileData: this.state.fileData} }}>
<p className='link-text'>Char Frequency</p>
</Link>
</li>
<li className='nav-link'>
<Link to={{ pathname: '/pairFrequency', data: {fileData: this.state.fileData} }}>
<p className='link-text'>Pair Frequency</p>
</Link>
</li>
<li className='nav-link'>
<Link to={{ pathname: '/vowelVSconsonant', data: {fileData: this.state.fileData} }}>
<p className='link-text'>Vowel - Consonant</p>
</Link>
</li>
</ul>
</div>
<Switch>
<Route path="/home" component={Home}/>
<Route path='/charFrequency' component={CharFrequency}/>
<Route path='/pairFrequency' component={DoubleCharFrequency}/>
<Route path='/vowelVSConsonant' component={VowelVSConsonant}/>
</Switch>
</Router>
);
}
}
export default App;