From 02c04badacd3bf9f4b74dc09ec621b483d7d7d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 17:49:57 +0100 Subject: [PATCH] Start converting to react-router --- frontend/package.json | 1 + frontend/src/App.jsx | 6 +- frontend/src/components/Nav.jsx | 14 +- frontend/src/components/SessionList.jsx | 162 ++++++++++++++++++++++++ frontend/src/error-page.jsx | 16 +++ frontend/src/main.jsx | 26 +++- 6 files changed, 215 insertions(+), 10 deletions(-) create mode 100644 frontend/src/components/SessionList.jsx create mode 100644 frontend/src/error-page.jsx diff --git a/frontend/package.json b/frontend/package.json index 2199022..3f7acce 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,6 +16,7 @@ "prettier": "^2.8.3", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-router-dom": "^6.7.0", "tailwindcss": "^3.2.4" }, "devDependencies": { diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 6abeeac..115716b 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,15 +1,15 @@ -import { useState } from "react"; import "./App.css"; import Nav from "./components/Nav"; +import { Outlet, useLoaderData } from "react-router-dom"; function App() { - const [count, setCount] = useState(0); + return ( <>
{/* {% load version %} */} {/* {% version %} ({% version_date %}) */} diff --git a/frontend/src/components/Nav.jsx b/frontend/src/components/Nav.jsx index b85921c..b81c171 100644 --- a/frontend/src/components/Nav.jsx +++ b/frontend/src/components/Nav.jsx @@ -1,16 +1,18 @@ +import { Link } from 'react-router-dom'; + function Nav() { return (