How to browse back button in React Router Dom v4?

I don’t believe you can fully disable a browser back button. You can, however, prevent the browser from carrying out the ‘back’ action.

history.pushState(null, null, location.href);
    window.onpopstate = function () {
        history.go(1);
    };

Something along those lines should work. Let me know if this solves your problem!

1 Like