Categories
React Answers

How to fix the “‘react-router’ does not contain an export named ‘browserHistory'” error with React Router?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *