Migrate useRouterHistory

230 views Asked by At

I am migrating and app with pretty old react-router (2.8.0) to v6. I couldn't find out how to migrate this line.

const ReactRouter = require( 'react-router' ),
    createHashHistory = require( 'react-outer/node_modules/history/lib/createHashHistory' ),
    createHashHistory = require( 'react-router/node_modules/history' ).createHashHistory,
    useRouterHistory = ReactRouter.useRouterHistory;

var appHistory = useRouterHistory(createHashHistory)( { queryKey: false } );

I found out that the location for createHashHistory changed to require( 'react-router/node_modules/history' ).createHashHistory, but I couldn't find out what to do with useRouterHistory.

If I omit it I no longer have query in the object causing a lot of dependent code to break.

I read through this issue, but all the links there are broken:(

Any ideas?

0

There are 0 answers