Files
gitbook/docs/api/navigation.md
T
2016-10-03 10:35:24 +02:00

24 lines
484 B
Markdown

# Navigation
### Listen to url change
Listen for changes to the current location:
```js
const onLocationChanged = (location) => {
console.log(location.pathname);
console.log(location.query);
console.log(location.hash);
};
module.exports = GitBook.createPlugin({
init: (dispatch, getState, { Navigation }) => {
dispatch(Navigation.listen(onLocationChanged));
}
});
```
The `onLocationChanged` will be triggered for initial state.
### Changing the url