简体   繁体   中英

Attempted import error: 'BrowseRouter' is not exported from 'react-router-dom' (imported as 'Router')

I dont know why i am getting this error, i have tried searching online and i saw some suggestions which i tried out but the error wouldn't clear. Please does anyone have any idea on what am doing wrong. Here is my code:

import React from 'react';

import { BrowseRouter as Router, Route } from 'react-router-dom';

import Join from './components/Join';
import Chat from './components/Chat';

const App = () => (
    <Router>
        <Route path="/" exact component={Join} />
        <Route path="/chat" exact component={Chat} />
    </Router>
);

export default App;

react-router-dom doesn't export BrowseRouter , it exports BrowserRouter .

Documentation here

there is a misspelled on BrowserRouter** you have it as BrowseRouter. it should be BrowserRouter not BrowseRouter. try this

import { BrowserRouter as Router } from "react-router-dom";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM