Redirect React JS
window.location.href = "http://mywebsite.com/home.html";
Grepper
window.location.href = "http://mywebsite.com/home.html";
import { Route, Redirect } from 'react-router'
<Route exact path="/" render={() => (
loggedIn ? (
<Redirect to="/dashboard"/>
) : (
<PublicHomePage/>
)
)}/>
window.location.href = 'http://domain.com';
state = { redirect: null };
render() {
if (this.state.redirect) {
return <Redirect to={this.state.redirect} />
}
return(
// Your Code goes here
)
}