From a87c3fcaafc8c839ae1263f84502634ef61081ec Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Mar 2018 16:12:24 +0300 Subject: switch to react-router --- vnext/src/app.js | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'vnext/src/app.js') diff --git a/vnext/src/app.js b/vnext/src/app.js index 1991a14d..82209e45 100644 --- a/vnext/src/app.js +++ b/vnext/src/app.js @@ -1,37 +1,50 @@ import React from "react" import ReactDOM from "react-dom" -import createHistory from 'history/createBrowserHistory'; -const history = createHistory(); +import { BrowserRouter as Router, Route, Link } from "react-router-dom" -import Navigation from "./components/Navigation" import Discover from "./components/Discover" import Post from "./components/Post" class App extends React.Component { constructor(props) { - super(props) - this.navigate = this.navigate.bind(this); + super(props); this.state = { - location: history.location + visitor: { uid: 0 } } } render() { return ( -
- - { location.pathname === "/" && - } - { location.pathname === "/post" && - } -
+ +
+
+
+ + + +
+
+ + +
+
) - } - navigate(location) { - console.log(location); - history.push(location); - this.setState({location: location}) } - } -- cgit v1.2.3