I'm trying to use createMemoryHistory on the router and I'm getting the typescript error :{
the code is this and the message is in the image..
import { Router } from 'react-router-dom'
import { createMemoryHistory } from 'history'
const history = createMemoryHistory()
const makeSut = () => {
const sut = render(
<Router history={history}>
<Login />
</Router>
)
}
CodePudding user response:
It is no longer needed to create the history
object yourself. Use the BrowserRouter
component instead or the Router
component
CodePudding user response:
the test I'm doing is on the object's history,
I found this solution
<Router navigator={history} location={history.location}>
...
</Router>