diff --git a/src/index.tsx b/src/index.tsx index 83ad5ea..72d0201 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,6 @@ +import React from "react"; import {SetStateAction, useState} from "react"; -import {BrowserRouter as Router, Route, Routes} from "react-router-dom"; +import {BrowserRouter as Router, Route, Routes, useNavigate} from "react-router-dom"; import Home from "./pages/home"; import Project from "./pages/project" import About from "./pages/about"; @@ -20,7 +21,7 @@ function App() { // project_path = "/:" + Projects_Content[i][1][1].replace(/\s/g, "-"); // Replace spaces with dashes for url project_routes.push ( // Project_Content[i][1][1] gets first element after descriptor from project page (should probably be a title) - } key={i}> + }> ) } @@ -29,6 +30,8 @@ function App() { + }> + }> {project_routes} }> @@ -39,4 +42,13 @@ function App() { ); } +function RedirectToHome() { + const navigate = useNavigate(); + React.useEffect(() => { + navigate("/"); + }, []); + + return null; +} + export default App; \ No newline at end of file