I'm currently using React Router DOM v 6.8.1 and history v 5.3.0
I just followed this example
But I get a TS error when trying to use history to HistoryRouter
<HistoryRouter history={history}>
// code
</HistoryRouter>
Type 'BrowserHistory' is missing the following properties from type 'History': createURL, encodeLocationts(2739)
Here is an example on codesandbox

Change the
react-router-domversion to 6.3.0 and it should work. Else use a custom-maderouterfunction. Refer to the Screenshot how to use ahistoryinreact-router-dom