1

I am using react and react-router do we have any replacement of window.location.assign or any other window method for redirection in react or react-router? I want to redirect to some other website. Not on the same react website from which I am redirecting. I found this answer How to emulate window.location with react-router and ES6 classes but it is redirecting to some other page in the react application only so, this is not sufficient for me.

I am using react-router v4+

Aniruddh Agarwal
  • 838
  • 1
  • 5
  • 21

1 Answers1

-1

Have you tried using the history package, after installing history package,

import createHistory from 'history/createBrowserHistory';

const history = createHistory();
history.push('www.abc.com');
history.go(0);
Shyam Kumar
  • 138
  • 9