Skip to content

Commit b0a6956

Browse files
committed
Add href property to the router state object
Adding `href` to the router state object gives access to the `$state.href` function in React code. This allows the creation of urls for states, which is critical when a component links to another part of the app and should be crawlable by a crawler.
1 parent e202148 commit b0a6956

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/router-middleware.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default function routerMiddleware($state) {
2828
payload: {
2929
currentState: $state.current,
3030
currentParams: $state.params,
31+
href: $state.href,
3132
prevState: getState().router.currentState,
3233
prevParams: getState().router.currentParams,
3334
},

0 commit comments

Comments
 (0)