Skip to content

Instantly share code, notes, and snippets.

@jasonrhodes
Created March 27, 2018 18:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonrhodes/b551380bc2c17c2c61683894b6adb751 to your computer and use it in GitHub Desktop.
Save jasonrhodes/b551380bc2c17c2c61683894b6adb751 to your computer and use it in GitHub Desktop.
import { Route } from 'react-router-dom'
export default function Redirect({ to, from, ...rest }) {
return <Route path={from} {...rest} render={({ location }) => (
<Redirect to={{ ...location, pathname: to }} />
)} />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment