Skip to content

Commit

Permalink
Modified path to homepage in package.json to be in synch with app bro…
Browse files Browse the repository at this point in the history
…wser router basename and vite config base. Updated README
  • Loading branch information
chrisnajman committed Jun 11, 2024
1 parent 9e27cd4 commit 2f30058
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
69 changes: 69 additions & 0 deletions README.md
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/" */}
```

---
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanlife",
"homepage": "https://chrisnajman.github.io/vanlife/",
"homepage": "https://chrisnajman.github.io/vanlife",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down

0 comments on commit 2f30058

Please sign in to comment.