Skip to content

Commit ddc3fe6

Browse files
committed
edit some code
1 parent 94bd4f0 commit ddc3fe6

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/Router/React_Router.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ import Data from "../components/Main-Section/Data/Data";
66

77
const React_Router = () => {
88

9-
// how to create path and path component in react router
9+
// how to create path and path component in react router . for that we havet to use react router createBrowserRouter function .
1010
const router = createBrowserRouter([
1111

1212
{
13-
//path declaration
13+
//the path declaration . for that we have to use path react router keywords .
1414
path: "/",
15-
//path component
15+
//the path component . for that we have to use element react router keywords .
1616
element: <Main />,
17-
//child path and path component declaration
17+
// the child path and path component declaration . sometimes we need some dynamic change in website without reaload the the website , for that we have to use react router children keywords .
1818
children: [
1919
{
20-
//child path
20+
// the child path
2121
path: "About",
22-
//child path component
22+
// the child path component
2323
element: <About />
2424
},
2525
{
26-
//child path
26+
// the child path
2727
path: "Data",
28-
//child path component
28+
// the child path component
2929
element: <Data />
3030
}
3131
]
@@ -35,7 +35,7 @@ const React_Router = () => {
3535

3636
return (
3737
<>
38-
{/* Call react-router */}
38+
{/* Call react-router using RouterProvider . */}
3939
<RouterProvider router={router} />
4040
</>
4141
);

src/components/Header-Section/Header.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Link } from "react-router-dom";
2+
13
const Header = () => {
24
return (
35
<>
@@ -10,8 +12,8 @@ const Header = () => {
1012
<ul
1113
tabIndex={0}
1214
className="menu menu-sm dropdown-content bg-base-100 rounded-box z-1 mt-3 w-52 p-2 shadow">
13-
<li><a href="../Main-Section/About/About.jsx">About</a></li>
14-
<li><a href="../Main-Section/Data/Data.jsx">Data</a></li>
15+
<li><Link to="About">About</Link></li>
16+
<li><Link to="Data">Data</Link></li>
1517
</ul>
1618
</div>
1719
<a className="btn btn-ghost text-xl">KING ALVI</a>
@@ -23,8 +25,11 @@ const Header = () => {
2325
</ul>
2426
</div>
2527
<div className="navbar-end">
26-
<input type="text" placeholder="Search" className="input input-bordered w-24 md:w-auto" />
27-
<span className="pl-3"><a className="btn">Search</a></span>
28+
<input
29+
type="text"
30+
placeholder="Search"
31+
className="input input-bordered join-item w-52" />
32+
<button className="btn btn-primary join-item">Search</button>
2833
</div>
2934
</div>
3035
</>

src/components/Main-Section/Main/Main.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const Main = () => {
66
return (
77
<div>
88
<Header />
9+
{/* the dynamic change will apper here when the path change . we have to use react router outlet for that . */}
910
<Outlet />
1011
<Footer />
1112
</div>

0 commit comments

Comments
 (0)