Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup: Routing in app #12

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"react-router-dom": "^6.28.0"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
Expand Down
34 changes: 34 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import './App.css';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import Navbar from './components/navbar';
import FeatureFlagList from './pages/FeatureFlagList';
import FeatureFlagDetails from './pages/FeatureFlagDetails';

const App = () => {
return (
<>
<BrowserRouter>
<Navbar />
</>
<Routes>
<Route path="/featureFlag" element={<FeatureFlagList />} />
<Route path="/featureFlag/:id" element={<FeatureFlagDetails />} />
</Routes>
</BrowserRouter>
);
};

Expand Down
15 changes: 15 additions & 0 deletions src/pages/FeatureFlagDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { useParams } from 'react-router-dom';

const FeatureFlagDetails: React.FC = () => {
const { id } = useParams();

return (
<div className="container mx-auto mt-20 p-4">
<h1 className="mb-4 text-2xl font-bold">Feature Flag Details</h1>
<p>Feature Flag ID: {id}</p>
</div>
);
};

export default FeatureFlagDetails;
10 changes: 10 additions & 0 deletions src/pages/FeatureFlagList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
const FeatureFlagList: React.FC = () => {
return (
<div className="container mx-auto mt-20 p-4">
<h1 className="mb-4 text-2xl font-bold">Feature Flags</h1>
</div>
);
};

export default FeatureFlagList;
Loading