Skip to content

Commit

Permalink
fix($docs): update connectRoutes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
faceyspacey committed Jun 28, 2017
1 parent 4613d1a commit 0ee12af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/connectRoutes.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type Options = {
* **title** - the `title` is similarly the name of the state key for your page title. **Redux First Router** will change your page
title for you when the route changes, e.g. `document.title = 'foo'`.

* **notFoundPath** - the `notFoundPath` will be set as the `pathname` in actions when the path corresponding to an action cannot be determined. It's worth noting that if path was pushed from the Address Bar, but there was no matching route, we preserve that path and leave it up to you to decide what to do with it (similar to how you can land on incorrect Github pages where nothing exists, but where the URL stays the same). There are a few other cases where we may know the path for sure, but can't successfull fulfill the request. The path is preserved *(and `notFoundPath` is NOT used)* when we can.
* **notFoundPath** - the `notFoundPath` defaults to `'/not-found'`. The address gets redirected here in 2 situations: when you dispatch an action with no matching path, or if you manually call `dispatch(redirect({ type: NOT_FOUND }))`, where `NOT_FOUND` is an export from this package. The type in actions and state will be `NOT_FOUND`, which you can use to show a 404 page. Conversely, if the user visits a URL directly or if you dispatch `NOT_FOUND` without the redirect, the ***current URL is preserved*** but the `NOT_FOUND` type is *also* dispatched, which is the correct way websites are typically supposed to deal with URLs they don't handle. *I.e. just like on Github.com, a 404 graphic will show and the URL stays the same.* So you will *rarely see* `'/not-found'` unless you trigger it (intentionally or by accident). Lastly if you specify `notFoundPath: null`, in the aforementioned scenarios, the URL will display as the previous URL (i.e. the URL currently in the address bar) and fallback to `'/'`, such as in SSR if no history exists yet.

* **scrollTop** - the `scrollTop` option calls `window.scrollTo(0, 0)` on route changes so the user starts each page at the top. This is a *"poor man's"* scroll
restoration, and should be fine while developing, especially if you're using Chrome. Though hash links won't fully function. See the next option for full-on scroll restoration support.
Expand Down

0 comments on commit 0ee12af

Please sign in to comment.