1

I need to redirect to new URL for my application. I have an event on which I am changing the URL. Here URL is updated but page is not redirected. It only redirects after refresh. Please help me to solve this. Thanks.

JS:

 _onNewFlowCreated(newFlow) {
        let url= '/#/flows/'+ newFlow.uid +'/edit';
        //window.history.pushState({}, '', url);
         window.location.href= url;
    }

I tried using react-router. But not found solution.

Ved
  • 11,837
  • 5
  • 42
  • 60

2 Answers2

1

try this one

import { Router, Redirect, Route, Link, browserHistory, IndexRoute, useRouterHistory, RouterContext, hashHistory } from 'react-router';
import { createHashHistory } from 'history';
Sagar
  • 69
  • 5
0

if you are using reactjs use

browserHistory.push('/#/flows/'+ newFlow.uid +'/edit');

to navigate to another url

Ayo K
  • 1,719
  • 2
  • 22
  • 34