From e6a5b31ca93bff50031c6ccef602df6825ab6c34 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 20 Sep 2022 08:20:20 -0400 Subject: [PATCH] docs: add data router note to ScrollRestoration --- docs/components/scroll-restoration.md | 3 +++ docs/route/action.md | 4 ++-- docs/route/error-element.md | 4 ++-- docs/route/should-revalidate.md | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/components/scroll-restoration.md b/docs/components/scroll-restoration.md index f3f73d043f..d3dd20fab3 100644 --- a/docs/components/scroll-restoration.md +++ b/docs/components/scroll-restoration.md @@ -7,6 +7,8 @@ new: true 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. +This feature only works if using a data router, see [Picking a Router][pickingarouter] + You should only render one of these and it's recommended you render it in the root route of your app: ```tsx [1,7] @@ -97,3 +99,4 @@ Server Rendering frameworks can prevent scroll flashing because they can send a [remix]: https://remix.run [preventscrollreset]: ../components/link#preventscrollreset +[pickingarouter]: ../routers/picking-a-router diff --git a/docs/route/action.md b/docs/route/action.md index 676ae54a00..0754ac5f61 100644 --- a/docs/route/action.md +++ b/docs/route/action.md @@ -7,7 +7,7 @@ new: true 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. -This feature only works if using a data router like [`createBrowserRouter`][createbrowserrouter] +This feature only works if using a data router, see [Picking a Router][pickingarouter] ```tsx `), the error path will be rendered (``) and the error made available with [`useRouteError`][userouteerror]. -This feature only works if using a data router like [`createBrowserRouter`][createbrowserrouter] +This feature only works if using a data router, see [Picking a Router][pickingarouter] ```tsx This feature only works if using a data router, see [Picking a Router][pickingarouter] + There are several instances where data is revalidated, keeping your UI in sync with your data automatically: - After an [`action`][action] is called from a [`
`][form]. @@ -76,3 +78,4 @@ interface ShouldRevalidateFunction { [loader]: ./loader [useloaderdata]: ../hooks/use-loader-data [params]: ./route#dynamic-segments +[pickingarouter]: ../routers/picking-a-router