pejay-ui 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +2 -2
- package/package.json +1 -1
- package/registry.json +39 -3
- package/templates/notes/create-pejay.md +222 -0
- package/templates/notes/notes-v1.md +516 -0
- package/templates/notes/notes-v2.md +764 -0
- package/templates/notes/notes-v3.md +574 -0
- package/templates/notes/notes-v4.md +811 -0
- package/templates/notes/notes-v5.md +579 -0
- package/templates/notes/notes-vf+1.md +311 -0
- package/templates/notes/notes-vfinal.md +852 -0
- package/templates/scaffolds/axios/api/index.ts +40 -0
- package/templates/scaffolds/axios/api/one.api.ts +94 -0
- package/templates/scaffolds/axios/endpoints.ts +9 -0
- package/templates/scaffolds/axios/index.ts +26 -0
- package/templates/scaffolds/axios/interceptors.ts +103 -0
- package/templates/scaffolds/axios/request.ts +32 -0
- package/templates/scaffolds/react-router/hook/useRouterSearch.ts +8 -0
- package/templates/scaffolds/react-router/router/guards/private.route.tsx +1 -0
- package/templates/scaffolds/react-router/router/index.ts +26 -0
- package/templates/scaffolds/react-router/router/layouts/error.layout.tsx +1 -1
- package/templates/scaffolds/redux-store/middlewares.ts +0 -0
- package/templates/scaffolds/redux-store/reducers.ts +30 -0
- package/templates/scaffolds/redux-store/selector/one.selector.ts +43 -0
- package/templates/scaffolds/redux-store/selector/two.selector.ts +11 -0
- package/templates/scaffolds/redux-store/slices/one.slice.ts +202 -0
- package/templates/scaffolds/redux-store/slices/two.slice.ts +21 -0
- package/templates/scaffolds/redux-store/store.ts +38 -0
- package/templates/scaffolds/rtk-query/baseApi.ts +24 -0
- package/templates/scaffolds/rtk-query/baseQuery.ts +12 -0
- package/templates/scaffolds/rtk-query/endpoints/api.one.ts +82 -0
- package/templates/scaffolds/rtk-query/endpoints/index.ts +1 -0
- package/templates/scaffolds/rtk-query/middlewares.ts +11 -0
- package/templates/scaffolds/rtk-query/queryTags.ts +13 -0
- package/templates/scaffolds/tanstack-query/api-base.ts +68 -68
- package/templates/scaffolds/tanstack-query/api-queries.ts +0 -19
- package/templates/scaffolds/tanstack-query/client.ts +8 -0
- package/templates/scaffolds/tanstack-query/module/index.ts +12 -12
- package/templates/scaffolds/tanstack-query/module/keys.ts +17 -17
- package/templates/scaffolds/tanstack-query/module/mappers.ts +15 -15
- package/templates/scaffolds/tanstack-query/module/mutations.ts +59 -55
- package/templates/scaffolds/tanstack-query/module/queries.ts +145 -156
- package/templates/scaffolds/tanstack-query/module/services.ts +74 -66
- package/templates/scaffolds/tanstack-router/layout/404.layout.tsx +3 -0
- package/templates/scaffolds/tanstack-router/layout/app.layout.tsx +10 -0
- package/templates/scaffolds/tanstack-router/layout/auth.layout.tsx +10 -0
- package/templates/scaffolds/tanstack-router/layout/error.layout.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/auth/login.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/one/index.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/one/one-id.tsx +128 -0
- package/templates/scaffolds/tanstack-router/router.ts +90 -0
- package/templates/scaffolds/tanstack-router/routes/_404.tsx +0 -0
- package/templates/scaffolds/tanstack-router/routes/__root.tsx +9 -0
- package/templates/scaffolds/tanstack-router/routes/_app.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/_auth.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/_error.tsx +0 -0
- package/templates/scaffolds/tanstack-router/routes/auth/login.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/one/$id.tsx +191 -0
- package/templates/scaffolds/tanstack-router/routes/one/index.tsx +6 -0
- package/templates/scripts/setup.bat +284 -0
- package/templates/scripts/setup.ps1 +318 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
# TanStack Router Learning Roadmap
|
|
2
|
+
|
|
3
|
+
This document summarizes everything covered so far and acts as a long-term reference for deciding what to learn, what to use, and what to avoid.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Section 1 - Topics Covered vs Topics Remaining
|
|
8
|
+
|
|
9
|
+
## ✅ Topics Covered
|
|
10
|
+
|
|
11
|
+
### Routing Fundamentals
|
|
12
|
+
|
|
13
|
+
```txt
|
|
14
|
+
File-Based Routing
|
|
15
|
+
|
|
16
|
+
Root Route
|
|
17
|
+
|
|
18
|
+
Route Hierarchy
|
|
19
|
+
|
|
20
|
+
Layouts
|
|
21
|
+
|
|
22
|
+
Nested Routes
|
|
23
|
+
|
|
24
|
+
Auth Layout
|
|
25
|
+
|
|
26
|
+
Main Layout
|
|
27
|
+
|
|
28
|
+
Error Layout
|
|
29
|
+
|
|
30
|
+
Outlet
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Navigation
|
|
36
|
+
|
|
37
|
+
```txt
|
|
38
|
+
<Link />
|
|
39
|
+
|
|
40
|
+
useNavigate()
|
|
41
|
+
|
|
42
|
+
router.navigate()
|
|
43
|
+
|
|
44
|
+
redirect()
|
|
45
|
+
|
|
46
|
+
Route.useNavigate()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### Route Parameters
|
|
52
|
+
|
|
53
|
+
```txt
|
|
54
|
+
Route.useParams()
|
|
55
|
+
|
|
56
|
+
Dynamic Routes
|
|
57
|
+
|
|
58
|
+
$id Routes
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
|
|
63
|
+
```txt
|
|
64
|
+
/users/$id
|
|
65
|
+
|
|
66
|
+
/patients/$id
|
|
67
|
+
|
|
68
|
+
/invoices/$id
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Search Parameters
|
|
74
|
+
|
|
75
|
+
```txt
|
|
76
|
+
validateSearch()
|
|
77
|
+
|
|
78
|
+
Route.useSearch()
|
|
79
|
+
|
|
80
|
+
Search Param Navigation
|
|
81
|
+
|
|
82
|
+
Typed Search Params
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Examples:
|
|
86
|
+
|
|
87
|
+
```txt
|
|
88
|
+
?page=1
|
|
89
|
+
|
|
90
|
+
?search=john
|
|
91
|
+
|
|
92
|
+
?status=active
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### Route Guards
|
|
98
|
+
|
|
99
|
+
```txt
|
|
100
|
+
beforeLoad()
|
|
101
|
+
|
|
102
|
+
Public Route
|
|
103
|
+
|
|
104
|
+
Private Route
|
|
105
|
+
|
|
106
|
+
Auth Checks
|
|
107
|
+
|
|
108
|
+
Permission Checks
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### Data Loading
|
|
114
|
+
|
|
115
|
+
```txt
|
|
116
|
+
loader()
|
|
117
|
+
|
|
118
|
+
ensureQueryData()
|
|
119
|
+
|
|
120
|
+
Route.useLoaderData()
|
|
121
|
+
|
|
122
|
+
loaderDeps()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### TanStack Query Integration
|
|
128
|
+
|
|
129
|
+
```txt
|
|
130
|
+
useSuspenseQuery()
|
|
131
|
+
|
|
132
|
+
Query Prefetching
|
|
133
|
+
|
|
134
|
+
Query Cache
|
|
135
|
+
|
|
136
|
+
Loader + Query Integration
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### Loading States
|
|
142
|
+
|
|
143
|
+
```txt
|
|
144
|
+
pendingComponent
|
|
145
|
+
|
|
146
|
+
pendingMs
|
|
147
|
+
|
|
148
|
+
pendingMinMs
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### Context
|
|
154
|
+
|
|
155
|
+
```txt
|
|
156
|
+
createRootRouteWithContext()
|
|
157
|
+
|
|
158
|
+
Route.useRouteContext()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### Router Utilities
|
|
164
|
+
|
|
165
|
+
```txt
|
|
166
|
+
useRouter()
|
|
167
|
+
|
|
168
|
+
useRouterState()
|
|
169
|
+
|
|
170
|
+
router.invalidate()
|
|
171
|
+
|
|
172
|
+
useMatchRoute()
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Code Splitting
|
|
178
|
+
|
|
179
|
+
```txt
|
|
180
|
+
Auto Route Splitting
|
|
181
|
+
|
|
182
|
+
React.lazy()
|
|
183
|
+
|
|
184
|
+
Suspense
|
|
185
|
+
|
|
186
|
+
Manual Component Splitting
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### Error Handling
|
|
192
|
+
|
|
193
|
+
```txt
|
|
194
|
+
errorComponent
|
|
195
|
+
|
|
196
|
+
notFoundComponent
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🔶 Topics Remaining
|
|
202
|
+
|
|
203
|
+
These are useful but not required for most CRM/Admin projects.
|
|
204
|
+
|
|
205
|
+
### SSR
|
|
206
|
+
|
|
207
|
+
```txt
|
|
208
|
+
TanStack Start
|
|
209
|
+
|
|
210
|
+
Hydration
|
|
211
|
+
|
|
212
|
+
Dehydration
|
|
213
|
+
|
|
214
|
+
Streaming
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Useful for:
|
|
218
|
+
|
|
219
|
+
```txt
|
|
220
|
+
Marketing Sites
|
|
221
|
+
|
|
222
|
+
SEO Driven Apps
|
|
223
|
+
|
|
224
|
+
Public Facing Platforms
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
### Route Masking
|
|
230
|
+
|
|
231
|
+
```txt
|
|
232
|
+
Modal URLs
|
|
233
|
+
|
|
234
|
+
Overlay URLs
|
|
235
|
+
|
|
236
|
+
Wizard URLs
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Rarely needed.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### View Transitions
|
|
244
|
+
|
|
245
|
+
```txt
|
|
246
|
+
Animated Route Transitions
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Nice UX feature.
|
|
250
|
+
|
|
251
|
+
Not business critical.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
### Custom History
|
|
256
|
+
|
|
257
|
+
```txt
|
|
258
|
+
Memory History
|
|
259
|
+
|
|
260
|
+
Hash History
|
|
261
|
+
|
|
262
|
+
Custom Browser History
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Mostly niche.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### Advanced Route Preloading
|
|
270
|
+
|
|
271
|
+
```txt
|
|
272
|
+
router.preloadRoute()
|
|
273
|
+
|
|
274
|
+
Preload Strategies
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Performance optimization.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
# Section 2 - Must Know vs Can Skip
|
|
282
|
+
|
|
283
|
+
## Must Know
|
|
284
|
+
|
|
285
|
+
These will be used almost daily.
|
|
286
|
+
|
|
287
|
+
### Core Routing
|
|
288
|
+
|
|
289
|
+
```txt
|
|
290
|
+
File-Based Routing
|
|
291
|
+
|
|
292
|
+
Layouts
|
|
293
|
+
|
|
294
|
+
Outlet
|
|
295
|
+
|
|
296
|
+
Nested Routes
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### Navigation
|
|
302
|
+
|
|
303
|
+
```txt
|
|
304
|
+
<Link />
|
|
305
|
+
|
|
306
|
+
useNavigate()
|
|
307
|
+
|
|
308
|
+
redirect()
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### Route Data
|
|
314
|
+
|
|
315
|
+
```txt
|
|
316
|
+
Route.useParams()
|
|
317
|
+
|
|
318
|
+
Route.useSearch()
|
|
319
|
+
|
|
320
|
+
validateSearch()
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### Authentication
|
|
326
|
+
|
|
327
|
+
```txt
|
|
328
|
+
beforeLoad()
|
|
329
|
+
|
|
330
|
+
Public Routes
|
|
331
|
+
|
|
332
|
+
Private Routes
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### Query Integration
|
|
338
|
+
|
|
339
|
+
```txt
|
|
340
|
+
loader()
|
|
341
|
+
|
|
342
|
+
ensureQueryData()
|
|
343
|
+
|
|
344
|
+
useSuspenseQuery()
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### Loading States
|
|
350
|
+
|
|
351
|
+
```txt
|
|
352
|
+
pendingComponent
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
### Context
|
|
358
|
+
|
|
359
|
+
```txt
|
|
360
|
+
createRootRouteWithContext()
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Learn Soon
|
|
366
|
+
|
|
367
|
+
Useful in medium to large applications.
|
|
368
|
+
|
|
369
|
+
```txt
|
|
370
|
+
Route.useRouteContext()
|
|
371
|
+
|
|
372
|
+
router.invalidate()
|
|
373
|
+
|
|
374
|
+
useRouter()
|
|
375
|
+
|
|
376
|
+
useRouterState()
|
|
377
|
+
|
|
378
|
+
loaderDeps()
|
|
379
|
+
|
|
380
|
+
notFoundComponent()
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Can Skip Initially
|
|
386
|
+
|
|
387
|
+
You may never need these.
|
|
388
|
+
|
|
389
|
+
```txt
|
|
390
|
+
Route Masking
|
|
391
|
+
|
|
392
|
+
Custom History
|
|
393
|
+
|
|
394
|
+
View Transitions
|
|
395
|
+
|
|
396
|
+
SSR
|
|
397
|
+
|
|
398
|
+
Streaming
|
|
399
|
+
|
|
400
|
+
Hydration
|
|
401
|
+
|
|
402
|
+
Dehydration
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Learn only if a project demands it.
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
# Section 3 - Feature Usage By Project Type
|
|
410
|
+
|
|
411
|
+
## CRM / Admin Panel
|
|
412
|
+
|
|
413
|
+
Examples:
|
|
414
|
+
|
|
415
|
+
```txt
|
|
416
|
+
Prime Hearing
|
|
417
|
+
|
|
418
|
+
Fleet Nexa
|
|
419
|
+
|
|
420
|
+
ERP
|
|
421
|
+
|
|
422
|
+
Internal Dashboard
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Recommended:
|
|
426
|
+
|
|
427
|
+
```txt
|
|
428
|
+
File Routing
|
|
429
|
+
|
|
430
|
+
beforeLoad()
|
|
431
|
+
|
|
432
|
+
Route.useParams()
|
|
433
|
+
|
|
434
|
+
Route.useSearch()
|
|
435
|
+
|
|
436
|
+
validateSearch()
|
|
437
|
+
|
|
438
|
+
loader()
|
|
439
|
+
|
|
440
|
+
ensureQueryData()
|
|
441
|
+
|
|
442
|
+
useSuspenseQuery()
|
|
443
|
+
|
|
444
|
+
pendingComponent()
|
|
445
|
+
|
|
446
|
+
createRootRouteWithContext()
|
|
447
|
+
|
|
448
|
+
router.invalidate()
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Avoid:
|
|
452
|
+
|
|
453
|
+
```txt
|
|
454
|
+
SSR
|
|
455
|
+
|
|
456
|
+
Streaming
|
|
457
|
+
|
|
458
|
+
Route Masking
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Usually unnecessary.
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Basic CRUD App
|
|
466
|
+
|
|
467
|
+
Examples:
|
|
468
|
+
|
|
469
|
+
```txt
|
|
470
|
+
Task Manager
|
|
471
|
+
|
|
472
|
+
Inventory App
|
|
473
|
+
|
|
474
|
+
Simple Employee App
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Recommended:
|
|
478
|
+
|
|
479
|
+
```txt
|
|
480
|
+
File Routing
|
|
481
|
+
|
|
482
|
+
Route.useParams()
|
|
483
|
+
|
|
484
|
+
useNavigate()
|
|
485
|
+
|
|
486
|
+
useSuspenseQuery()
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
Optional:
|
|
490
|
+
|
|
491
|
+
```txt
|
|
492
|
+
loader()
|
|
493
|
+
|
|
494
|
+
ensureQueryData()
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Avoid:
|
|
498
|
+
|
|
499
|
+
```txt
|
|
500
|
+
Complex Context Setup
|
|
501
|
+
|
|
502
|
+
Route Masking
|
|
503
|
+
|
|
504
|
+
Advanced Router State
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## Large Enterprise App
|
|
510
|
+
|
|
511
|
+
Examples:
|
|
512
|
+
|
|
513
|
+
```txt
|
|
514
|
+
ERP
|
|
515
|
+
|
|
516
|
+
Multi-Tenant SaaS
|
|
517
|
+
|
|
518
|
+
Healthcare Platform
|
|
519
|
+
|
|
520
|
+
Finance Platform
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Recommended:
|
|
524
|
+
|
|
525
|
+
```txt
|
|
526
|
+
Everything From CRM Section
|
|
527
|
+
|
|
528
|
+
+
|
|
529
|
+
loaderDeps()
|
|
530
|
+
|
|
531
|
+
useRouterState()
|
|
532
|
+
|
|
533
|
+
useMatchRoute()
|
|
534
|
+
|
|
535
|
+
Route Preloading
|
|
536
|
+
|
|
537
|
+
Permission-Based beforeLoad()
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## Public Website
|
|
543
|
+
|
|
544
|
+
Examples:
|
|
545
|
+
|
|
546
|
+
```txt
|
|
547
|
+
Marketing Website
|
|
548
|
+
|
|
549
|
+
Landing Pages
|
|
550
|
+
|
|
551
|
+
Documentation Site
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Recommended:
|
|
555
|
+
|
|
556
|
+
```txt
|
|
557
|
+
SSR
|
|
558
|
+
|
|
559
|
+
Streaming
|
|
560
|
+
|
|
561
|
+
Hydration
|
|
562
|
+
|
|
563
|
+
Route Preloading
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
TanStack Router alone is usually not enough.
|
|
567
|
+
|
|
568
|
+
Consider:
|
|
569
|
+
|
|
570
|
+
```txt
|
|
571
|
+
TanStack Start
|
|
572
|
+
Next.js
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
depending on requirements.
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
# Section 4 - Features That Are Commonly Overused
|
|
580
|
+
|
|
581
|
+
These are powerful but often unnecessary.
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Overusing Loaders
|
|
586
|
+
|
|
587
|
+
Bad:
|
|
588
|
+
|
|
589
|
+
```txt
|
|
590
|
+
Every Route Has Loader
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Good:
|
|
594
|
+
|
|
595
|
+
```txt
|
|
596
|
+
Loader Only When Data Is Needed Before Render
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Overusing Context
|
|
602
|
+
|
|
603
|
+
Bad:
|
|
604
|
+
|
|
605
|
+
```txt
|
|
606
|
+
Everything In Router Context
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
Good:
|
|
610
|
+
|
|
611
|
+
```txt
|
|
612
|
+
Auth
|
|
613
|
+
|
|
614
|
+
Query Client
|
|
615
|
+
|
|
616
|
+
Core Application Services
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Only.
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## Overusing Search Params
|
|
624
|
+
|
|
625
|
+
Bad:
|
|
626
|
+
|
|
627
|
+
```txt
|
|
628
|
+
Every Form State In URL
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Good:
|
|
632
|
+
|
|
633
|
+
```txt
|
|
634
|
+
Pagination
|
|
635
|
+
|
|
636
|
+
Filtering
|
|
637
|
+
|
|
638
|
+
Sorting
|
|
639
|
+
|
|
640
|
+
Search
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
Only store sharable page state.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## Overusing Manual Code Splitting
|
|
648
|
+
|
|
649
|
+
Bad:
|
|
650
|
+
|
|
651
|
+
```txt
|
|
652
|
+
Split Every Component
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
Good:
|
|
656
|
+
|
|
657
|
+
```txt
|
|
658
|
+
Large Drawers
|
|
659
|
+
|
|
660
|
+
Charts
|
|
661
|
+
|
|
662
|
+
Editors
|
|
663
|
+
|
|
664
|
+
PDF Viewers
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
Let route splitting handle most cases.
|
|
668
|
+
|
|
669
|
+
---
|
|
670
|
+
|
|
671
|
+
## Overusing useRouterState
|
|
672
|
+
|
|
673
|
+
Bad:
|
|
674
|
+
|
|
675
|
+
```txt
|
|
676
|
+
Tracking Everything Through Router State
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
Good:
|
|
680
|
+
|
|
681
|
+
```txt
|
|
682
|
+
Global Loading
|
|
683
|
+
|
|
684
|
+
Route Analytics
|
|
685
|
+
|
|
686
|
+
Navigation Monitoring
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
## Overusing beforeLoad
|
|
692
|
+
|
|
693
|
+
Bad:
|
|
694
|
+
|
|
695
|
+
```txt
|
|
696
|
+
API Calls
|
|
697
|
+
|
|
698
|
+
Business Logic
|
|
699
|
+
|
|
700
|
+
Complex Data Processing
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Good:
|
|
704
|
+
|
|
705
|
+
```txt
|
|
706
|
+
Authentication
|
|
707
|
+
|
|
708
|
+
Authorization
|
|
709
|
+
|
|
710
|
+
Route Entry Checks
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
# Section 5 - My Recommended Architecture
|
|
716
|
+
|
|
717
|
+
For your style of projects:
|
|
718
|
+
|
|
719
|
+
```txt
|
|
720
|
+
src/
|
|
721
|
+
├─ routes/
|
|
722
|
+
├─ pages/
|
|
723
|
+
├─ layouts/
|
|
724
|
+
├─ components/
|
|
725
|
+
├─ services/
|
|
726
|
+
├─ queries/
|
|
727
|
+
├─ mutations/
|
|
728
|
+
├─ mappers/
|
|
729
|
+
└─ router/
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
---
|
|
733
|
+
|
|
734
|
+
Routes:
|
|
735
|
+
|
|
736
|
+
```txt
|
|
737
|
+
Only Routing Logic
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
Example:
|
|
741
|
+
|
|
742
|
+
```txt
|
|
743
|
+
loader()
|
|
744
|
+
|
|
745
|
+
beforeLoad()
|
|
746
|
+
|
|
747
|
+
validateSearch()
|
|
748
|
+
|
|
749
|
+
pendingComponent()
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
---
|
|
753
|
+
|
|
754
|
+
Pages:
|
|
755
|
+
|
|
756
|
+
```txt
|
|
757
|
+
UI + Query Usage
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
Example:
|
|
761
|
+
|
|
762
|
+
```txt
|
|
763
|
+
Route.useParams()
|
|
764
|
+
|
|
765
|
+
Route.useSearch()
|
|
766
|
+
|
|
767
|
+
useSuspenseQuery()
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
Services:
|
|
773
|
+
|
|
774
|
+
```txt
|
|
775
|
+
API Calls Only
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
Queries:
|
|
781
|
+
|
|
782
|
+
```txt
|
|
783
|
+
queryOptions()
|
|
784
|
+
|
|
785
|
+
Query Keys
|
|
786
|
+
|
|
787
|
+
Query Factories
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
# Section 6 - What Makes TanStack Router Worth It?
|
|
793
|
+
|
|
794
|
+
If someone asked:
|
|
795
|
+
|
|
796
|
+
```txt
|
|
797
|
+
Why not stay with React Router?
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
My answer would be:
|
|
801
|
+
|
|
802
|
+
```txt
|
|
803
|
+
Typed Params
|
|
804
|
+
|
|
805
|
+
Typed Search Params
|
|
806
|
+
|
|
807
|
+
beforeLoad()
|
|
808
|
+
|
|
809
|
+
Route Context
|
|
810
|
+
|
|
811
|
+
Query Integration
|
|
812
|
+
|
|
813
|
+
File Routing
|
|
814
|
+
|
|
815
|
+
Auto Route Splitting
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
These features remove a lot of boilerplate that tends to accumulate in larger React Router applications.
|
|
819
|
+
|
|
820
|
+
---
|
|
821
|
+
|
|
822
|
+
# Final Advice
|
|
823
|
+
|
|
824
|
+
Master these first:
|
|
825
|
+
|
|
826
|
+
```txt
|
|
827
|
+
1. File Routing
|
|
828
|
+
|
|
829
|
+
2. Layout Hierarchy
|
|
830
|
+
|
|
831
|
+
3. beforeLoad()
|
|
832
|
+
|
|
833
|
+
4. Route.useParams()
|
|
834
|
+
|
|
835
|
+
5. Route.useSearch()
|
|
836
|
+
|
|
837
|
+
6. validateSearch()
|
|
838
|
+
|
|
839
|
+
7. loader()
|
|
840
|
+
|
|
841
|
+
8. ensureQueryData()
|
|
842
|
+
|
|
843
|
+
9. useSuspenseQuery()
|
|
844
|
+
|
|
845
|
+
10. pendingComponent()
|
|
846
|
+
|
|
847
|
+
11. createRootRouteWithContext()
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
If you can comfortably build a CRUD screen using those 11 concepts, you're already operating at a level where most real-world TanStack Router applications will feel familiar.
|
|
851
|
+
|
|
852
|
+
Everything beyond that should be learned when a project actually requires it, not because the feature exists.
|