Reputation: 65
This is the following code which is giving an error Is is that I am importing BrowserRouter incorrectly or something? Can someone please help me figure this out?
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root')
);
serviceWorker.unregister();
Upvotes: 0
Views: 2401
Reputation: 507
Yes, you are not currently importing BrowserRouter
at all.
You will need to add this line to your import statements.
import { BrowserRouter } from 'react-router-dom'
You'll also need to install the react-router-dom
dependency if you haven't done that.
Upvotes: 5