redirect react js
window.location.href = "http://mywebsite.com/home.html";import { Route, Redirect } from 'react-router'
<Route exact path="/" render={() => (
loggedIn ? (
<Redirect to="/dashboard"/>
) : (
<PublicHomePage/>
)
)}/><Route exact path="/">
{loggedIn ? <Redirect to="/dashboard" /> : <PublicHomePage />}
</Route>
state = { redirect: null };
render() {
if (this.state.redirect) {
return <Redirect to={this.state.redirect} />
}
return(
// Your Code goes here
)
}
<Redirect to="/somewhere/else" />
import { useHistory } from "react-router-dom";
function App() {
let history = useHistory();
}
Also in JavaScript:
- trim whitespace javascript
- icon api node js to browser
- post express node js input
- facebook pixel
- javascript document.createElement add function
- Changes not staged for commit: modified: ../package.json
- jquery dialog button text set by variable
- three js get size of object
- format string of names
- javascript quick float to integer
- jquery count selected options
- get year javascript copyright
- ejs-multiselect
- first element of array js
- body parser express
- js loop backwards
- javascript ... operator three dots
- react check if array contains value
- javascript encode url to decode C#
- javascript round to nearest integer
- javascript match image attribute value
- loop through nested json object typescript
- substring javascript
- click left event listener javascrip