Skip to content

Commit

Permalink
react router
Browse files Browse the repository at this point in the history
  • Loading branch information
Turtle-Hwan committed Jul 5, 2024
1 parent f5745d8 commit ef0ab2c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 39 deletions.
50 changes: 11 additions & 39 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import "./App.css";
import { styled } from "styled-components";
import { createBrowserRouter, Link, RouterProvider } from "react-router-dom";
import HomePage from "./pages/HomePage/HomePage";

const Button = styled.button`
background-color: green;
`;

function Test() {
const [count, setCount] = useState(0);

return (
<>
<Link to={"/Home"}>Go to Home</Link>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<Button onClick={() => setCount((count) => count + 1)}>count is {count}</Button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<div className="text-3xl font-bold underline">it goes Work!!</div>
<p className="read-the-docs">Click on the Vite and R eact logos to learn more</p>
</>
);
}
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import HomePage from "./pages/HomePage";
import HabitDetailPage from "./pages/HabitDetailPage/HabitDetailPage";
import FeedPage from "./pages/FeedPage/FeedPage";

function App() {
const routes = [
{ path: "/", element: <Test /> },
{ path: "/Home", element: <HomePage /> },
{ path: "/", element: <HomePage /> },
{ path: "/habitDetail", element: <HabitDetailPage /> },
{ path: "/feed", element: <FeedPage /> },
{ path: "/addHabit" },
{ path: "myprogress" },
{ path: "/store" },
{ path: "/option" },
];
const router = createBrowserRouter(routes, { basename: "/KUIT3_Hackathon_Team5-Web/" });

Expand Down
3 changes: 3 additions & 0 deletions src/pages/FeedPage/FeedPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function FeedPage() {
return <h1>FeedPage ν™”λ©΄μž…λ‹ˆλ‹€μ•„μ•„μ•„μ•„μ•„</h1>;
}
3 changes: 3 additions & 0 deletions src/pages/HabitDetailPage/HabitDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function HabitDetailPage() {
return <h1>HabitDetailPage ν™”λ©΄μž…λ‹ˆλ‹€μ•„μ•„μ•„μ•„μ•„</h1>;
}
File renamed without changes.

0 comments on commit ef0ab2c

Please sign in to comment.