Skip to content

Commit e6a5b31

Browse files
committed
docs: add data router note to ScrollRestoration
1 parent f722d7f commit e6a5b31

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

docs/components/scroll-restoration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ new: true
77

88
This component will emulate the browser's scroll restoration on location changes after loaders have completed to ensure the scroll position is restored to the right spot, even across domains.
99

10+
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
11+
1012
You should only render one of these and it's recommended you render it in the root route of your app:
1113

1214
```tsx [1,7]
@@ -97,3 +99,4 @@ Server Rendering frameworks can prevent scroll flashing because they can send a
9799

98100
[remix]: https://remix.run
99101
[preventscrollreset]: ../components/link#preventscrollreset
102+
[pickingarouter]: ../routers/picking-a-router

docs/route/action.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ new: true
77

88
Route actions are the "writes" to route [loader][loader] "reads". They provide a way for apps to perform data mutations with simple HTML and HTTP semantics while React Router abstracts away the complexity of asynchronous UI and revalidation. This gives you the simple mental model of HTML + HTTP (where the browser handles the asynchrony and revalidation) with the behavior and UX capabilities of modern SPAs.
99

10-
<docs-error>This feature only works if using a data router like [`createBrowserRouter`][createbrowserrouter]</docs-error>
10+
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
1111

1212
```tsx
1313
<Route
@@ -144,4 +144,4 @@ For more details and expanded use cases, read the [errorElement][errorelement] d
144144
[workingwithformdata]: ../guides/form-data
145145
[useactiondata]: ../hooks/use-action-data
146146
[returningresponses]: ./loader#returning-responses
147-
[createbrowserrouter]: ../routers/create-browser-router
147+
[pickingarouter]: ../routers/picking-a-router

docs/route/error-element.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ new: true
77

88
When exceptions are thrown in [loaders][loader], [actions][action], or component rendering, instead of the normal render path for your Routes (`<Route element>`), the error path will be rendered (`<Route errorElement>`) and the error made available with [`useRouteError`][userouteerror].
99

10-
<docs-error>This feature only works if using a data router like [`createBrowserRouter`][createbrowserrouter]</docs-error>
10+
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
1111

1212
```tsx
1313
<Route
@@ -213,4 +213,4 @@ The project route doesn't have to think about errors at all. Between the loader
213213
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
214214
[isrouteerrorresponse]: ../utils/is-route-error-response
215215
[json]: ../fetch/json
216-
[createbrowserrouter]: ../routers/create-browser-router
216+
[pickingarouter]: ../routers/picking-a-router

docs/route/should-revalidate.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ new: true
77

88
This function allows you opt-out of revalidation for a route's loader as an optimization.
99

10+
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
11+
1012
There are several instances where data is revalidated, keeping your UI in sync with your data automatically:
1113

1214
- After an [`action`][action] is called from a [`<Form>`][form].
@@ -76,3 +78,4 @@ interface ShouldRevalidateFunction {
7678
[loader]: ./loader
7779
[useloaderdata]: ../hooks/use-loader-data
7880
[params]: ./route#dynamic-segments
81+
[pickingarouter]: ../routers/picking-a-router

0 commit comments

Comments
 (0)