Skip to content

Commit

Permalink
added routing
Browse files Browse the repository at this point in the history
added routing
  • Loading branch information
Jose Camilo committed Aug 3, 2024
1 parent 595070b commit 7ec1f31
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 17 deletions.
13 changes: 13 additions & 0 deletions .vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}





41 changes: 40 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1"
"react-icons": "^5.2.1",
"react-router-dom": "^6.26.0"
},
"devDependencies": {
"@types/react": "^18.3.3",
Expand Down
30 changes: 15 additions & 15 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import Navbar from "./components/Navbar";
import Hero from "./components/Hero";
import HomeCards from "./components/HomeCards";
import JobListings from "./components/JobListings";
import ViewAllJobs from "./components/ViewAllJobs";
import { Route, createBrowserRouter, createRoutesFromElements, RouterProvider } from "react-router-dom";
import HomePage from "./pages/HomePage";
import MainLayout from "./layouts/MainLayout"

const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<MainLayout />}>
<Route index element={<HomePage />} />
</Route>
));

const App = () => {
return (
<>
<Navbar />
<Hero title='Become a React Dev' subtitle='Find the React job that fits your skills and needs!'/>
<HomeCards />
<JobListings />
<ViewAllJobs />
</>
)
return <RouterProvider router={router} />
};

export default App;



// Next Lesson Use State
// https://www.youtube.com/watch?v=LDB4uaJ87e0&t=1644s
// https://www.youtube.com/watch?v=LDB4uaJ87e0&t=1644s

// React Router
// https://youtu.be/LDB4uaJ87e0?t=4757
13 changes: 13 additions & 0 deletions src/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Outlet } from "react-router-dom"
import Navbar from "../components/Navbar"

const MainLayout = () => {
return (
<>
<Navbar />
<Outlet/>
</>
)
}

export default MainLayout
18 changes: 18 additions & 0 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Hero from "../components/Hero";
import HomeCards from "../components/HomeCards";
import JobListings from "../components/JobListings";
import ViewAllJobs from "../components/ViewAllJobs";

const HomePage = () => {
return (
<>
<Hero title='Become a React Dev' subtitle='Find the React job that fits your skills and needs!' />
<HomeCards />
<JobListings />
<ViewAllJobs/>
</>
)
}

export default HomePage

0 comments on commit 7ec1f31

Please sign in to comment.