I\'m attempting to use a basename with react-router as documented on the react-router docs. This is due to base href being deprecated.
Here is what I have now:
I solved it by using:
import { Router, useRouterHistory } from 'react-router'
import createBrowserHistory from 'history/lib/createBrowserHistory'
const history = useRouterHistory(createBrowserHistory)({
basename: '/',
})
I think the issue was different versions of the history
package. react-router@2.2.4
uses history@2.1.2
, while history
is already at 4.5.1
.
So make sure you install the correct version of the history
package.