尝试解决问题“尝试导入错误:'BrowerRouter'未从'react-router-dom'(导入为'Router')中导出。

时间:2020-09-14 21:20:11

标签: reactjs react-redux react-router-dom

在学习一些React之前,一直按照教程学习,我一直遇到这个特殊问题。我已经关闭了开发服务器,并重新启动了VSCode,这似乎可以解决其他问题。

这是我的App.js

    import React, { Fragment } from "react";
import { BrowerRouter as Router, Route, Switch } from "react-router-dom";
import Navbar from "./components/layout/Navbar";
import Landing from "./components/layout/Landing";
import "./App.css";

const App = () => {
  <Router>
    <Fragment>
      <Navbar />
      <Route exact path="/" component={Landing} />
    </Fragment>
  </Router>;
};

export default App;

这是我的package.json

    {
  "name": "devconnector",
  "version": "1.0.0",
  "description": "AM doing BT's React Course",
  "main": "server.js",
  "scripts": {
    "start": "node server",
    "server": "nodemon server",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\""
  },
  "author": "Andrew M.",
  "license": "MIT",
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "config": "^3.3.1",
    "express": "^4.17.1",
    "express-validator": "^6.6.1",
    "gravatar": "^1.8.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.9.27",
    "react-router-dom": "^5.2.0",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "concurrently": "^5.2.0",
    "nodemon": "^2.0.4"
  },
  "proxy": "http://localhost:5000"
}

如果您有任何建议,请帮助

1 个答案:

答案 0 :(得分:2)

是错字。您在输入“ BrowerRouter”时输入的是“ BrowserRouter”