Sometimes, we want to fix the "’react-router’ does not contain an export named ‘browserHistory’" error with React Router.
In this article, we’ll look at how to fix the "’react-router’ does not contain an export named ‘browserHistory’" error with React Router.
How to fix the "’react-router’ does not contain an export named ‘browserHistory’" error with React Router?
To fix the "’react-router’ does not contain an export named ‘browserHistory’" error with React Router, we should call the createBrowserHistory
function.
For instance, we write
import { createBrowserHistory } from 'history'
to import createBrowserHistory
.
And then we can call it and use the returned history
object elsewhere.
Conclusion
To fix the "’react-router’ does not contain an export named ‘browserHistory’" error with React Router, we should call the createBrowserHistory
function.