Skip to content

Commit 0a49665

Browse files
committed
[added] Router.makeHref
promoting this to public API so others can use it to build components like `<Link/>` closes #168
1 parent c906506 commit 0a49665

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

docs/api/Router.md

+13
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,16 @@ entry from the browser history.
5151
Router.goBack();
5252
```
5353

54+
### `makeHref(routeName, params, query)`
55+
56+
Creates an `href` to a route. Use this along with `ActiveState` when you
57+
need to build components similar to `Link`.
58+
59+
#### Example
60+
61+
```js
62+
// given a route like this:
63+
<Route name="user" path="users/:userId"/>
64+
Router.makeHref('user', {userId: 123}); // "users/123"
65+
```
66+

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ exports.Routes = require('./Routes');
66
exports.goBack = require('./goBack');
77
exports.replaceWith = require('./replaceWith');
88
exports.transitionTo = require('./transitionTo');
9+
exports.makeHref = require('./makeHref');

makeHref.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./modules/helpers/makeHref');

0 commit comments

Comments
 (0)