Files
2016-10-03 10:35:24 +02:00

484 B

Navigation

Listen to url change

Listen for changes to the current location:

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