Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Last active April 30, 2019 19:39
Show Gist options
  • Save the-teacher/62b3a45f0b4974cd9a965665f033c31d to your computer and use it in GitHub Desktop.
Save the-teacher/62b3a45f0b4974cd9a965665f033c31d to your computer and use it in GitHub Desktop.
import React from 'react'
import { Router, Route } from 'react-router-dom'
import { createMemoryHistory } from 'history'
const history = createMemoryHistory()
const TestingRouter = ({ ComponentWithRedirection, RedirectUrl }) => (
<Router history={history}>
<Route path="/" exact={true} render={() => <ComponentWithRedirection />} />
<Route path={RedirectUrl} render={() => <div>{RedirectUrl}</div>} />
</Router>
)
export default TestingRouter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment