blob: fed735f7733817e1ad5084d30f2d7d26317a6875 (
plain) (
blame)
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
|
import React from "react"
import ReactDOM from "react-dom"
import createHistory from 'history/createBrowserHistory';
const history = createHistory();
import Navigation from "./components/Navigation"
import Discover from "./components/Discover"
class App extends React.Component {
constructor(props) {
super(props)
this.navigate = this.navigate.bind(this);
this.state = {
location: history.location
}
}
render() {
return (
<div className="wrapper">
<Navigation onNavigate={this.navigate} />
<Discover params={this.state.location.search} />
</div>
)
}
navigate(location) {
console.log(location);
history.push(location);
this.setState({location: location})
}
}
ReactDOM.render(<App />, document.getElementById("wrapper"));
|