You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/tutorial.md
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,7 @@ export default function Invoices() {
172
172
173
173
Finally, let's teach React Router how to render our app at different URLs by creating our first "Route Config" inside of `main.jsx`.
174
174
175
-
```tsx lines=[2,4-5,10-14] filename=src/main.jsx
175
+
```tsx lines=[2,4-5,13-19] filename=src/main.jsx
176
176
import { render } from"react-dom";
177
177
import {
178
178
BrowserRouter,
@@ -211,7 +211,7 @@ Let's get some automatic, persistent layout handling by doing just two things:
211
211
212
212
First let's nest the routes. Right now the expenses and invoices routes are siblings to to the app, we're want to make them _children_ of the app route:
213
213
214
-
```jsx lines=[11-14] filename=src/main.jsx
214
+
```jsx lines=[15-18] filename=src/main.jsx
215
215
import { render } from"react-dom";
216
216
import {
217
217
BrowserRouter,
@@ -243,7 +243,7 @@ When routes have children it does two things:
243
243
244
244
However, before (2) will work we need to render an `Outlet` in the `App.jsx` "parent" route.
245
245
246
-
```jsx lines=[1,11] filename=src/App.jsx
246
+
```jsx lines=[1,16] filename=src/App.jsx
247
247
import { Outlet, Link } from"react-router-dom";
248
248
249
249
exportdefaultfunctionApp() {
@@ -316,7 +316,7 @@ export function getInvoices() {
316
316
317
317
Now we can use it in the invoices route. Let's also add a bit of styling to get a sidebar nav layout going on. Feel free to copy/paste all of this, but take special note of the `<Link>` elements `to` prop:
318
318
319
-
```js lines=[12] filename=src/routes/invoices.jsx
319
+
```js lines=[17] filename=src/routes/invoices.jsx
320
320
import { Link } from"react-router-dom";
321
321
import { getInvoices } from"../data";
322
322
@@ -418,8 +418,8 @@ Alright, now go click a link to an invoice, note that the URL changes but the ne
418
418
419
419
That's right! We need to add an outlet to the parent layout route (we're really proud of you).
@@ -467,7 +467,7 @@ Note that the key of the param on the `params` object is the same as the dynamic
467
467
468
468
Let's use that information to build up a more interesting invoice page. Open up `src/data.js` and add a newfunction to lookup invoices by their number:
469
469
470
-
```js filename=src/data.js lines=[7-9]
470
+
```js filename=src/data.js lines=[7-11]
471
471
// ...
472
472
473
473
export function getInvoices() {
@@ -552,7 +552,7 @@ Maybe you're still scratching your head. There are a few ways we try to answer t
552
552
553
553
It's very common, especially in navigation lists, to display the link as the active link the user is looking at. Let's add this treatment to our invoices list by swapping out `Link` for `NavLink`.
0 commit comments