Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'react-router' does not contain an export named 'BrowserRouter'

I'm using react-router version 5.5.1 and am trying to use it in my index.js file:

./src/index.js
14:8-21 'react-router' does not contain an export named 'BrowserRouter'

The import statement within my index.js:

import { render } from 'react-dom';
import { BrowserRouter, Match, Miss } from 'react-router';
like image 393
Flame of udun Avatar asked Apr 12 '18 03:04

Flame of udun


People also ask

What is the BrowserRouter /> component?

BrowserRouter: BrowserRouter is a router implementation that uses the HTML5 history API(pushState, replaceState and the popstate event) to keep your UI in sync with the URL. It is the parent component that is used to store all of the other components.

What is the difference between BrowserRouter and router?

At the core of every React Router application should be a router component. For web projects, react-router-dom provides <BrowserRouter> and <HashRouter> routers. The main difference between the two is the way they store the URL and communicate with your web server. A <BrowserRouter> uses regular URL paths.


1 Answers

you need to import BrowserRouter from react-router-dom

import { BrowserRouter } from 'react-router-dom'

more info about BrowserRouter

like image 129
Alex Munoz Avatar answered Oct 13 '22 19:10

Alex Munoz