Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to navigate backwards? #10

Open
avesus opened this issue Aug 22, 2016 · 4 comments
Open

How to navigate backwards? #10

avesus opened this issue Aug 22, 2016 · 4 comments

Comments

@avesus
Copy link

avesus commented Aug 22, 2016

How to use standard navigation actions of react-router, i.e. goBack(), replace() etc?

@johanneslumpe
Copy link
Owner

How to use replace is described here. Besides push and replace not other methods are currently supported.

@avesus
Copy link
Author

avesus commented Aug 22, 2016

I badly need goBack with great library!

On Monday, August 22, 2016, Johannes Lumpe notifications@github.com wrote:

How to use replace is described here
https://github.com/johanneslumpe/redux-history-transitions#can-i-perform-replace-transitions-instead-of-push.
Besides push and replace not other methods are currently supported.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD9MIxgGA9v0HNs00Gsj-6onACkvlHfUks5qiYssgaJpZM4Jpld0
.

Best Regards,
Ivan Borisenko

@jagged3dge
Copy link

jagged3dge commented Sep 1, 2016

I wonder if this'll work. Modify executeTransition like below. Adds an additional check for a key named method in your transition definition. I feel it could be safe cuz I believe neither history API nor react-router consume a method key in any of their operations.

export const executeTransition = history => transitionData => {
  if (transitionData) {
   // const method = transitionData.replace ? 'replace' : 'push';
   const method = transitionData.method || (transitionData.replace ? 'replace' : 'push');
    history[method](transitionData);
  }
};

Example action:

export default {

  goPrevious() {
    return {
      type: PAGE_PREV,
      payload: {
        page: 23
      },
      meta: {
        transition: (prevState, nextState, action) => ({ method: 'goBack' }),
      },
    };
  },
}

@HZSamir
Copy link

HZSamir commented Sep 25, 2017

A goBack and goForward feature would be most welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants