From 0a49665f2df48b591d1100be130b80e7ed3e31f4 Mon Sep 17 00:00:00 2001 From: Ryan Florence Date: Wed, 6 Aug 2014 16:15:10 -0600 Subject: [PATCH] [added] Router.makeHref promoting this to public API so others can use it to build components like `` closes #168 --- docs/api/Router.md | 13 +++++++++++++ index.js | 1 + makeHref.js | 1 + 3 files changed, 15 insertions(+) create mode 100644 makeHref.js diff --git a/docs/api/Router.md b/docs/api/Router.md index 7b51f3641e..64d564ab72 100644 --- a/docs/api/Router.md +++ b/docs/api/Router.md @@ -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: + +Router.makeHref('user', {userId: 123}); // "users/123" +``` + diff --git a/index.js b/index.js index d2ccce8e4c..17fb46cff3 100644 --- a/index.js +++ b/index.js @@ -6,3 +6,4 @@ exports.Routes = require('./Routes'); exports.goBack = require('./goBack'); exports.replaceWith = require('./replaceWith'); exports.transitionTo = require('./transitionTo'); +exports.makeHref = require('./makeHref'); diff --git a/makeHref.js b/makeHref.js new file mode 100644 index 0000000000..d8eecd3a01 --- /dev/null +++ b/makeHref.js @@ -0,0 +1 @@ +module.exports = require('./modules/helpers/makeHref');