Skip to content

Commit

Permalink
[added] Router.makeHref
Browse files Browse the repository at this point in the history
promoting this to public API so others can use it
to build components like `<Link/>`

closes remix-run#168
  • Loading branch information
ryanflorence committed Aug 6, 2014
1 parent c906506 commit 0a49665
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/api/Router.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,16 @@ entry from the browser history.
Router.goBack();
```

### `makeHref(routeName, params, query)`

Creates an `href` to a route. Use this along with `ActiveState` when you
need to build components similar to `Link`.

#### Example

```js
// given a route like this:
<Route name="user" path="users/:userId"/>
Router.makeHref('user', {userId: 123}); // "users/123"
```

1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ exports.Routes = require('./Routes');
exports.goBack = require('./goBack');
exports.replaceWith = require('./replaceWith');
exports.transitionTo = require('./transitionTo');
exports.makeHref = require('./makeHref');
1 change: 1 addition & 0 deletions makeHref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./modules/helpers/makeHref');

0 comments on commit 0a49665

Please sign in to comment.