From 35d1b3fb486bd584fad892b223c83c4bda0c9c8a Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Thu, 14 May 2020 22:28:51 -0700 Subject: [PATCH] Update API reference links --- docs/README.md | 2 +- docs/api-reference.md | 36 ++++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/docs/README.md b/docs/README.md index 3183a2cff..5dd13fb12 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,4 +17,4 @@ You may also be interested in reading one of the following guides: - [Navigation](navigation.md) - [Blocking Transitions](blocking-transitions.md) -A [comprehensive API Reference](api-reference.md) is also available. +An [API Reference](api-reference.md) is also available. diff --git a/docs/api-reference.md b/docs/api-reference.md index 88df8cd81..0c9264dc2 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -1,17 +1,33 @@ # API Reference -This document is a comprehensive API reference for [the "history" JavaScript +This document is an API reference for [the history JavaScript library](https://github.com/ReactTraining/history). -Although there are several interfaces in the history library, the main -interfaces are: +Although there are several APIs in the history library, the main interfaces are: - The create* methods: - - [`createBrowserHistory`](#createbrowserhistory-window-window-) - - [`createHashHistory`](#createhashhistory-window-window-) - - [`createMemoryHistory`](#creatememoryhistory-initialentries-initialentry-initialindex-number-) + - [`createBrowserHistory({ window?: Window })`](#createbrowserhistory-window-window-) + - [`createHashHistory({ window?: Window })`](#createhashhistory-window-window-) + - [`createMemoryHistory({ initialEntries?: InitialEntry[], initialIndex?: number })`](#creatememoryhistory-initialentries-initialentry-initialindex-number-) - The [`History`](#history) interface + - [`history.action`](#historyaction) + - [`history.location`](#historylocation) + - [`history.createHref(to: To)`](#historycreatehrefto-to) + - [`history.push(to: To, state?: State)`](#historypushto-to-state-state) + - [`history.replace(to: To, state?: State)`](#historyreplaceto-to-state-state) + - [`history.go(delta: number)`](#historygodelta-number) + - [`history.back()`](#historyback) + - [`history.forward()`](#historyforward) + - [`history.listen(listener: Listener)`](#historylistenlistener-listener) + - [`history.block(blocker: Blocker)`](#historyblockblocker-blocker) - The [`Location`](#location) interface + - [`location.pathname`](#locationpathname) + - [`location.search`](#locationsearch) + - [`location.hash`](#locationhash) + - [`location.state`](#locationstate) + - [`location.key`](#locationkey) +- The [`Action`](#action) enum +- The [`To`](#to) type alias ## `createBrowserHistory({ window?: Window })` @@ -75,7 +91,7 @@ interface History<S extends createHref(to: To): string; push(to: To, state?: S): void; replace(to: To, state?: S): void; - go(n: number): void; + go(n: number): void; back(): void; forward(): void; listen(listener: Listener<S>): () => void; @@ -174,9 +190,9 @@ information. ## Location -The word "location" in React Router refers to a particular entry in the history -stack, usually analogous to a "page" or "screen" in your app. As the user clicks -on links and moves around the app, the location changes. +A `location` is a particular entry in the history stack, usually analogous to a +"page" or "screen" in your app. As the user clicks on links and moves around the +app, the current location changes. A `location` object has the following interface: