-
Notifications
You must be signed in to change notification settings - Fork 9
/
App.js
43 lines (35 loc) · 780 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
39
40
41
42
import React from 'react'
import { config } from '../src'
import { withContext } from 'recompose'
import Nav from './Nav'
import Footer from './Footer'
import Index from './Index'
import UI from './UI'
import history from './history'
class App extends React.Component {
constructor (props) {
super()
this.state = {
path: props.path
}
}
componentDidMount () {
const { pathname } = history.location
this.setState({ path: pathname })
history.listen(({ pathname }) => {
this.setState({ path: pathname })
})
}
render () {
const { path } = this.state
const view = path === '/ui' ? <UI /> : <Index />
return (
<div>
<Nav />
{view}
<Footer />
</div>
)
}
}
export default App