Skip to content

Router Actions

Triggers the browser history to PUSH a new page. This is a forward navigation.

import { historyPush } from '@shopgate/engage/core';
dispatch(historyPush({ pathname: '/' }));
  • params (Object) required: The parameters for the PUSH action.
    • pathname (string) required: The pathname to navigate to.
    • state (Object): With the state object data can be transfered to the upcoming route. The is NOT the redux state. It is metadata only for the routing transition.
    • silent (boolean): Defaults to false. If this is set to true, redux will not react on the current routing action and not dispatch any further actions. This should only be used to prevent side effects!

Trigger the browset history to POP the current page. This is a backwards navigation.

import { historyPop } from '@shopgate/engage/core';
dispatch(historyPop());

This will replace to current page with another. If no pathname to a new page is sent, it will POP the current page and therefore perform a backwards navigation instead.

import { historyReplace } from '@shopgate/engage/core';
dispatch(historyReplace({ pathname: '/some-page' }));
  • params (Object) required: The parameters for the replace action.
    • pathname (string): The pathname of the new page.
    • state (Object): With the state object data can be transfered to the upcoming route. The is NOT the redux state. It is metadata only for the routing transition.
    • silent (boolean): Defaults to false. If this is set to true, redux will not react on the current routing action and not dispatch any further actions. This should only be used to prevent side effects!

This will reset the browser history and clear the whole navigation stack.

import { historyReset } from '@shopgate/engage/core';
dispatch(historyReset());