-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified path to homepage in package.json to be in synch with app bro…
…wser router basename and vite config base. Updated README
- Loading branch information
1 parent
9e27cd4
commit 2f30058
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,72 @@ | ||
# Vanlife | ||
|
||
In progress ... | ||
|
||
## Nested Routes | ||
|
||
- Only use if there's some shared UI between elements. | ||
- Not recommended if you only want to eliminate path repetition. | ||
|
||
### Example | ||
|
||
Which of the following is the best solution? | ||
|
||
```jsx | ||
// 1) NON-NESTED - repetition of 'vans' in the paths. | ||
<Route | ||
path="vans" | ||
element={<Vans />} | ||
/> | ||
<Route | ||
path="vans/:id" | ||
element={<VanDetails />} | ||
/> | ||
|
||
|
||
// OR | ||
|
||
// 2) NESTED - repetition of 'vans' eliminated from paths. | ||
<Route path="vans"> | ||
<Route | ||
index | ||
element={<Vans />} | ||
/> | ||
<Route | ||
path=":id" | ||
element={<VanDetails />} | ||
/> | ||
</Route> | ||
``` | ||
|
||
- Both work, but as `<Vans />` and `<VanDetails />` do **not** share UI, "1) NON-NESTED" is the best choice. | ||
|
||
--- | ||
|
||
## Synch `vite.config.js`, `package.json` and `BrowserRouter basename` | ||
|
||
### `vite.config.js` | ||
|
||
```JavaScript | ||
base: "/vanlife", | ||
|
||
// NOT "/vanlife/", | ||
``` | ||
|
||
### `package.json` | ||
|
||
```JSON | ||
"homepage": "https://chrisnajman.github.io/vanlife", | ||
|
||
// NOT "https://chrisnajman.github.io/vanlife/", | ||
|
||
``` | ||
|
||
### `BrowserRouter basename` | ||
|
||
```jsx | ||
<BrowserRouter basename="/vanlife"> | ||
|
||
{/* NOT "/vanlife/" */} | ||
``` | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters