Jelajahi Sumber

ADDED: React router, homepage et detailPage

Axelle LANCA 2 tahun lalu
induk
melakukan
5b69040e07

+ 1 - 0
front/package.json

@@ -17,6 +17,7 @@
     "@testing-library/user-event": "^13.5.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
+    "react-router-dom": "^6.7.0",
     "react-scripts": "5.0.1",
     "web-vitals": "^2.1.4"
   },

+ 19 - 0
front/src/components/pages/DetailPage.jsx

@@ -0,0 +1,19 @@
+import React from "react";
+import { useHistory } from "react-router-dom";
+
+const DetailPage = () => {
+
+    const history = useHistory();
+    const HomePage = () => {
+        history.push("/");
+    }
+    return (
+        <>
+            <button onClick={HomePage}>Back to home page</button>
+        </>
+    )
+}
+
+export {
+    DetailPage
+}

+ 25 - 0
front/src/components/pages/HomePage.jsx

@@ -0,0 +1,25 @@
+import React from "react";
+
+import { useHistory } from "react-router-dom";
+
+const HomePage = () => {
+
+    const history = useHistory();
+    const DetailPage = () => {
+        history.push("/detail");
+    }
+
+    return (
+        <>
+            <h1>Home Page</h1>
+
+            {/* Loop to go through the queues array */}
+
+
+        </>
+    );
+}
+
+export {
+    HomePage
+}