-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add react-router for todo app and slideshow
- Loading branch information
1 parent
bc06d80
commit 3835e42
Showing
7 changed files
with
94 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { Todos } from "./components/Todos"; | ||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools/production"; | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom"; | ||
import { TodosApp } from "./pages/TodoApp"; | ||
import { Home } from "./pages/Home"; | ||
import "./App.css"; | ||
import { Slideshow } from "./pages/Slideshow"; | ||
|
||
const queryClient = new QueryClient(); | ||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Home />, | ||
}, | ||
{ | ||
path: "/todos", | ||
element: <TodosApp />, | ||
}, | ||
{ | ||
path: "/slideshow", | ||
element: <Slideshow />, | ||
}, | ||
]); | ||
|
||
function App() { | ||
return ( | ||
<div className="container mx-auto"> | ||
<h1 className="text-3xl font-bold text-center mt-8 mb-8">My Todos</h1> | ||
<QueryClientProvider client={queryClient}> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
<Todos /> | ||
</QueryClientProvider> | ||
</div> | ||
); | ||
} | ||
const App = () => <RouterProvider router={router} />; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NavLink } from "react-router-dom"; | ||
|
||
export const Home = () => ( | ||
<div className="container mx-auto items-center text-center"> | ||
<h1 className="text-3xl font-bold text-center mt-8 mb-8"> | ||
Stories Of Todo | ||
</h1> | ||
<div className="flex flex-col gap-4"> | ||
<NavLink className="btn btn-outline btn-lg btn-accent" to="todos"> | ||
Todos | ||
</NavLink> | ||
<NavLink className="btn btn-outline btn-lg btn-info" to="slideshow"> | ||
Slideshow | ||
</NavLink> | ||
</div> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const Slideshow = () => <div>WIP</div>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; | ||
import { Todos } from "../components/Todos"; | ||
|
||
const queryClient = new QueryClient(); | ||
export const TodosApp = () => ( | ||
<div className="container mx-auto"> | ||
<h1 className="text-3xl font-bold text-center mt-8 mb-8">My Todos</h1> | ||
<QueryClientProvider client={queryClient}> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
<Todos /> | ||
</QueryClientProvider> | ||
</div> | ||
); |