Skip to content

Commit

Permalink
add Router
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanBonsignori committed Feb 19, 2024
1 parent 4ce4ea5 commit d2d6f23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
27 changes: 0 additions & 27 deletions src/App.tsx

This file was deleted.

7 changes: 5 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import { RouterProvider, createBrowserRouter } from "react-router-dom";
import "./index.css";
import Root from "./routes/Root";

const queryClient = new QueryClient();

const router = createBrowserRouter([{ path: "/", element: <Root /> }]);

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<RouterProvider router={router} />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
</React.StrictMode>
Expand Down
23 changes: 23 additions & 0 deletions src/routes/Root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Grid from "@mui/material/Grid";
import { FC } from "react";
import Layout from "../components/Layout";

const Root: FC = () => {
// const apiRoot = import.meta.env.VITE_API_ROOT;
// console.log("🚀 ~ apiRoot:", apiRoot);
// fetch(new URL(`${apiRoot}/api/v1/feature-request`))
// .then((res) => res.json())
// .then((data) => console.log(data));
return (
<Layout>
<Grid container spacing={2}>
<Grid item xs={12} key={1}>
<h2>{"test"}</h2>
<p>{"testste"}</p>
</Grid>
</Grid>
</Layout>
);
};

export default Root;

0 comments on commit d2d6f23

Please sign in to comment.