Home > OS >  history parameter has been removed from router in version 6.2.1?
history parameter has been removed from router in version 6.2.1?

Time:12-21

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>
  )
}

enter image description here

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>
  • Related