17
17
18
18
// export default App
19
19
20
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
21
+
22
+
20
23
//react v6
21
24
22
- import React from 'react'
23
- import { Route , Routes } from 'react-router-dom' ;
24
- import About from "./About"
25
- import Contact from "./Contact"
26
- import Error from "./Error"
27
- import Navbar from "./Navbar"
25
+ // import React from "react";
26
+ // import { Route, Routes } from "react-router-dom";
27
+ // import About from "./About";
28
+ // import Services from "./Services";
29
+ // import Contact from "./Contact";
30
+ // import Error from "./Error";
31
+ // import Navbar from "./Navbar";
32
+ // const App = () => {
33
+ // const Name = () => {
34
+ // return <h1>Himanshu Kothari Here.</h1>;
35
+ // };
36
+
37
+ // return (
38
+ // <>
39
+ // <div className="container">
40
+ // <Navbar />
41
+ // <Routes>
42
+ // <Route exact path="/" element={<About />} />
43
+ // <Route exact path="/contact" element={<Contact />} />
44
+ // <Route exact path="/services" element={<Services />} />
45
+ // <Route exact path="/contact/name" element={<Name />} />
46
+ // <Route path="*" element={<Error />} />
47
+ // </Routes>
48
+ // </div>
49
+ // {/* <About/>
50
+ // <Contact/> */}
51
+ // </>
52
+ // );
53
+ // };
54
+
55
+ // export default App;
56
+
57
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
58
+
59
+ //passing props in react router elements
60
+
61
+ // import React from "react";
62
+ // import { Route, Routes } from "react-router-dom";
63
+ // import About from "./About";
64
+ // import Services from "./Services";
65
+ // import Contact from "./Contact";
66
+ // import Error from "./Error";
67
+ // import Navbar from "./Navbar";
68
+ // const App = () => {
69
+ // const Name = () => {
70
+ // return <h1>Himanshu Kothari Here.</h1>;
71
+ // };
72
+
73
+ // return (
74
+ // <>
75
+ // <div className="container">
76
+ // <Navbar />
77
+ // <Routes>
78
+ // <Route exact path="/" element={<About name="HK" />}/>
79
+ // <Route exact path="/contact" element={<Contact name="Himanshu" />} />
80
+ // <Route exact path="/services" element={<Services />} />
81
+ // <Route exact path="/contact/name" element={<Name />} />
82
+ // <Route path="*" element={<Error />} />
83
+ // </Routes>
84
+ // </div>
85
+ // {/* <About/>
86
+ // <Contact/> */}
87
+ // </>
88
+ // );
89
+ // };
90
+
91
+ // export default App;
92
+
93
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
94
+
95
+
96
+ //useParams
97
+
98
+ // import React from "react";
99
+ // import { Route, Routes } from "react-router-dom";
100
+ // import About from "./About";
101
+ // import Services from "./Services";
102
+ // import Contact from "./Contact";
103
+ // import Error from "./Error";
104
+ // import User from "./User"
105
+ // import Navbar from "./Navbar";
106
+ // const App = () => {
107
+ // const Name = () => {
108
+ // return <h1>Himanshu Kothari Here.</h1>;
109
+ // };
110
+
111
+ // return (
112
+ // <>
113
+ // <div className="container">
114
+ // <Navbar />
115
+ // <Routes>
116
+ // <Route exact path="/" element={<About name="HK" />}/>
117
+ // <Route exact path="/contact" element={<Contact name="Himanshu" />} />
118
+ // <Route exact path="/services" element={<Services />} />
119
+ // <Route exact path="/contact/name" element={<Name />} />
120
+ // <Route exact path="/user" element={<User />} />
121
+ // <Route path="/user/:fname" element={<User />} />
122
+ // <Route path="*" element={<Error />} />
123
+ // </Routes>
124
+ // </div>
125
+ // {/* <About/>
126
+ // <Contact/> */}
127
+ // </>
128
+ // );
129
+ // };
130
+
131
+ // export default App;
132
+
133
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
134
+
135
+ //useLocation
136
+
137
+
138
+ // import React from "react";
139
+ // import { Route, Routes } from "react-router-dom";
140
+ // import About from "./About";
141
+ // import Services from "./Services";
142
+ // import Contact from "./Contact";
143
+ // import Error from "./Error";
144
+ // import User from "./User"
145
+ // import Navbar from "./Navbar";
146
+ // const App = () => {
147
+ // const Name = () => {
148
+ // return <h1>Himanshu Kothari Here.</h1>;
149
+ // };
150
+
151
+ // return (
152
+ // <>
153
+ // <div className="container">
154
+ // <Navbar />
155
+ // <Routes>
156
+ // <Route exact path="/" element={<About name="HK" />}/>
157
+ // <Route exact path="/contact" element={<Contact name="Himanshu" />} />
158
+ // <Route exact path="/services" element={<Services />} />
159
+ // <Route exact path="/contact/name" element={<Name />} />
160
+ // <Route exact path="/user" element={<User />} />
161
+ // <Route path="/user/:fname" element={<User />} />
162
+ // <Route path="*" element={<Error />} />
163
+ // </Routes>
164
+ // </div>
165
+ // {/* <About/>
166
+ // <Contact/> */}
167
+ // </>
168
+ // );
169
+ // };
170
+
171
+ // export default App;
172
+
173
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////
174
+
175
+ //useHistory
176
+
177
+ // const navigate = useNavigate ();
178
+ // For going back=> navigate(-1);
179
+ // For push => navigate('/about');
180
+
181
+ // import React from "react";
182
+ // import { Route, Routes } from "react-router-dom";
183
+ // import About from "./About";
184
+ // import Services from "./Services";
185
+ // import Contact from "./Contact";
186
+ // import Error from "./Error";
187
+ // import User from "./User"
188
+ // import Navbar from "./Navbar";
189
+ // const App = () => {
190
+ // const Name = () => {
191
+ // return <h1>Himanshu Kothari Here.</h1>;
192
+ // };
193
+
194
+ // return (
195
+ // <>
196
+ // <div className="container">
197
+ // <Navbar />
198
+ // <Routes>
199
+ // <Route exact path="/" element={<About name="HK" />}/>
200
+ // <Route exact path="/contact" element={<Contact name="Himanshu" />} />
201
+ // <Route exact path="/services" element={<Services />} />
202
+ // <Route exact path="/contact/name" element={<Name />} />
203
+ // <Route exact path="/user" element={<User />} />
204
+ // <Route path="/user/:fname" element={<User />} />
205
+ // <Route path="*" element={<Error />} />
206
+ // </Routes>
207
+ // </div>
208
+ // {/* <About/>
209
+ // <Contact/> */}
210
+ // </>
211
+ // );
212
+ // };
213
+
214
+ // export default App;
215
+
216
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
217
+
218
+ //search filter in react
219
+
220
+ import React from "react" ;
221
+ import { Route , Routes } from "react-router-dom" ;
222
+ import About from "./About" ;
223
+ import Services from "./Services" ;
224
+ import Contact from "./Contact" ;
225
+ import Error from "./Error" ;
226
+ import User from "./User"
227
+ import Search from "./Search" ;
228
+ import Navbar from "./Navbar" ;
28
229
const App = ( ) => {
230
+ const Name = ( ) => {
231
+ return < h1 > Himanshu Kothari Here.</ h1 > ;
232
+ } ;
29
233
30
- const Name = ( ) => {
31
- return < h1 > Himanshu Kothari Here.</ h1 >
32
- }
33
-
34
- return (
35
- < >
36
- < Navbar />
37
- < Routes >
38
- < Route exact path = '/' element = { < About /> } />
39
- < Route exact path = '/contact' element = { < Contact /> } />
40
- < Route path = '/contact/name' element = { < Name /> } />
41
- < Route path = "*" element = { < Error /> } />
42
- </ Routes >
43
-
44
- { /* <About/>
234
+ return (
235
+ < >
236
+ < div className = "container" >
237
+ < Navbar />
238
+ < Routes >
239
+ < Route exact path = "/" element = { < About name = "HK" /> } />
240
+ < Route exact path = "/contact" element = { < Contact name = "Himanshu" /> } />
241
+ < Route exact path = "/services" element = { < Services /> } />
242
+ < Route exact path = "/contact/name" element = { < Name /> } />
243
+ < Route exact path = "/user" element = { < User /> } />
244
+ < Route exact path = "/search" element = { < Search /> } />
245
+ < Route path = "/user/:fname" element = { < User /> } />
246
+ < Route path = "*" element = { < Error /> } />
247
+ </ Routes >
248
+ </ div >
249
+ { /* <About/>
45
250
<Contact/> */ }
46
- </ >
47
- )
48
- }
251
+ </ >
252
+ ) ;
253
+ } ;
49
254
50
- export default App
255
+ export default App ;
0 commit comments