|
1 | 1 | # API Reference |
2 | 2 |
|
3 | | -This document is a comprehensive API reference for [the "history" JavaScript |
| 3 | +This document is a comprehensive API reference for [the history JavaScript |
4 | 4 | library](https://github.com/ReactTraining/history). |
5 | 5 |
|
6 | 6 | Although there are several interfaces in the history library, the main |
7 | 7 | interfaces are: |
8 | 8 |
|
9 | 9 | - The create* methods: |
10 | | - - [`createBrowserHistory`](#createbrowserhistory-window-window-) |
11 | | - - [`createHashHistory`](#createhashhistory-window-window-) |
12 | | - - [`createMemoryHistory`](#creatememoryhistory-initialentries-initialentry-initialindex-number-) |
| 10 | + - [`createBrowserHistory({ window?: Window })`](#createbrowserhistory-window-window-) |
| 11 | + - [`createHashHistory({ window?: Window })`](#createhashhistory-window-window-) |
| 12 | + - [`createMemoryHistory({ initialEntries?: InitialEntry[], initialIndex?: number })`](#creatememoryhistory-initialentries-initialentry-initialindex-number-) |
13 | 13 | - The [`History`](#history) interface |
| 14 | + - [`history.action`](#historyaction) |
| 15 | + - [`history.location`](#historylocation) |
| 16 | + - [`history.createHref(to: To)`](#historycreatehrefto-to) |
| 17 | + - [`history.push(to: To, state?: State)`](#historypushto-to-state-state) |
| 18 | + - [`history.replace(to: To, state?: State)`](#historyreplaceto-to-state-state) |
| 19 | + - [`history.go(delta: number)`](#historygodelta-number) |
| 20 | + - [`history.back()`](#historyback) |
| 21 | + - [`history.forward()`](#historyforward) |
| 22 | + - [`history.listen(listener: Listener)`](#historylistenlistener-listener) |
| 23 | + - [`history.block(blocker: Blocker)`](#historyblockblocker-blocker) |
14 | 24 | - The [`Location`](#location) interface |
| 25 | + - [`location.pathname`](#locationpathname) |
| 26 | + - [`location.search`](#locationsearch) |
| 27 | + - [`location.hash`](#locationhash) |
| 28 | + - [`location.state`](#locationstate) |
| 29 | + - [`location.key`](#locationkey) |
| 30 | +- The [`Action`](#action) enum |
| 31 | +- The [`To`](#to) type alias |
15 | 32 |
|
16 | 33 | ## `createBrowserHistory({ window?: Window })` |
17 | 34 |
|
@@ -75,7 +92,7 @@ interface History<S extends <a href="https://github.com/ReactTraining/history |
75 | 92 | <a href="#historycreatehrefto-to">createHref</a>(to: <a href="#to">To</a>): string; |
76 | 93 | <a href="#historypushto-to-state-state">push</a>(to: <a href="#to">To</a>, state?: S): void; |
77 | 94 | <a href="#historyreplaceto-to-state-state">replace</a>(to: <a href="#to">To</a>, state?: S): void; |
78 | | - <a href="#historygodelta">go</a>(n: number): void; |
| 95 | + <a href="#historygodelta-number">go</a>(n: number): void; |
79 | 96 | <a href="#historyback">back</a>(): void; |
80 | 97 | <a href="#historyforward">forward</a>(): void; |
81 | 98 | <a href="#historylistenlistener-listener">listen</a>(listener: Listener<S>): () => void; |
@@ -174,9 +191,9 @@ information. |
174 | 191 |
|
175 | 192 | ## Location |
176 | 193 |
|
177 | | -The word "location" in React Router refers to a particular entry in the history |
178 | | -stack, usually analogous to a "page" or "screen" in your app. As the user clicks |
179 | | -on links and moves around the app, the location changes. |
| 194 | +A `location` is a particular entry in the history stack, usually analogous to a |
| 195 | +"page" or "screen" in your app. As the user clicks on links and moves around the |
| 196 | +app, the current location changes. |
180 | 197 |
|
181 | 198 | A `location` object has the following interface: |
182 | 199 |
|
|
0 commit comments