Skip to content

Commit e322c5b

Browse files
Downloadtaion
authored andcommitted
Explain arguments to match callback (in API docs for match).
Changed outdated note and added `match` to ToC See remix-run#2630 Fixes remix-run#2622
1 parent b5387f4 commit e322c5b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/API.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
* [Utilities](#utilities)
2525
* [useRoutes](#useroutescreatehistory)
26+
* [match](#matchlocation-cb)
2627
* [createRoutes](#createroutesroutes)
2728
* [PropTypes](#proptypes)
2829

@@ -675,8 +676,14 @@ Returns a new `createHistory` function that may be used to create history object
675676

676677
This function is to be used for server-side rendering. It matches a set of routes to a location, without rendering, and calls a `callback(error, redirectLocation, renderProps)` when it's done.
677678

678-
*Note: You probably don't want to use this in a browser. Use the [`history.listen`](https://github.com/rackt/history/blob/master/docs/GettingStarted.md#getting-started) API instead.*
679+
The three arguments to the callback function you pass to `match` are:
680+
* `error`: A Javascript `Error` object if an error occurred, `undefined` otherwise.
681+
* `redirectLocation`: A [Location](/docs/Glossary.md#location) object if the route is a redirect, `undefined` otherwise.
682+
* `renderProps`: The props you should pass to the routing context if the route matched, `undefined` otherwise.
679683

684+
If all three parameters are `undefined`, this means that there was no route found matching the given location.
685+
686+
*Note: You probably don't want to use this in a browser unless you're doing server-side rendering of async routes.*
680687

681688

682689
## `createRoutes(routes)`

0 commit comments

Comments
 (0)