From f1fa146d54b7ff2d6a8201c421d91611a5f7a64f Mon Sep 17 00:00:00 2001 From: yoidea Date: Mon, 21 Jan 2019 22:38:36 +0900 Subject: [PATCH 1/2] Add react router --- src/App.js | 11 ++++++++--- src/pages/questions.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/pages/questions.js diff --git a/src/App.js b/src/App.js index db241fb..6482fa4 100755 --- a/src/App.js +++ b/src/App.js @@ -1,12 +1,17 @@ import React, { Component } from "react"; +import { BrowserRouter, Route } from "react-router-dom"; import { Entrance } from "./pages/entrance"; +import { Questions } from "./pages/questions"; class App extends Component { render() { return ( -
- -
+ +
+ + +
+
); } } diff --git a/src/pages/questions.js b/src/pages/questions.js new file mode 100644 index 0000000..71dbf67 --- /dev/null +++ b/src/pages/questions.js @@ -0,0 +1,11 @@ +import React, { Component } from "react"; + +export class Questions extends Component { + render() { + return ( +
+

Questions

+
+ ); + } +} From 39c63e6202b82cb2b3c7af7a0c810d13c096478d Mon Sep 17 00:00:00 2001 From: yoidea Date: Mon, 21 Jan 2019 23:23:06 +0900 Subject: [PATCH 2/2] Implement page transition --- src/pages/entrance.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/entrance.js b/src/pages/entrance.js index 49cb760..43791c8 100644 --- a/src/pages/entrance.js +++ b/src/pages/entrance.js @@ -18,6 +18,9 @@ export class Entrance extends Component { } render() { + if (this.state.roomId.length === 3) { + this.props.history.push("/questions"); + } return (