“sakelar tidak diekspor dari react-router-dom” Kode Jawaban

sakelar tidak diekspor dari react-router-dom

uninstal react-router-dom
npm uninstall react-router-dom
//and install old version it will resolve the error
npm install [email protected]
search & solved

sakelar tidak diekspor dari react-router-dom

/*Step 1: Step 1. Upgrade to React 16.8+ and react-router-dom v6+ */
npm uninstall react-router-dom
npm install react-router-dom

/*Step 2: Update the react-router-dom import statement.*/
//Change import { Switch, Route } from "react-router-dom";
//to
import { Routes ,Route } from 'react-router-dom';

/*Step 3: Upgrade the syntax and replace "Switch" with "Routes" and "component" with "element" */
//Change
// <Switch>
//          <Route path="/home" component={HomePage} />
// </Switch>

//to
 
<Routes>
          <Route path="/home" element={<HomePage/>} />
</Routes>

//Alternatively you can also downgrade the react-router-version as suggested in other solutions,
//However, rather than going backwards, I would suggest to upgrade to latest version of react-router-dom and its syntax.
MoreOnFew.com

sakelar tidak diekspor dari react-router-dom

import React from "react";
    import "./App.css";
    import NavBar from "./components/navbar.js";
    import Footer from "./components/footer.js";
    import Home from "./components/pages/homepage/home.js";
    import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
    
    function App() {
      return (
        <Router>
          <div className="app-container">
            <NavBar />
            <Switch>
              <Route path="/home" component={Home} />
            </Switch>
            <Footer />
          </div>
        </Router>
      );
    }
    
    export default App;
search & solved

sakelar tidak diekspor dari react-router-dom

thank,,it worked after i changed to version 5.2
Konkimalla Kalyani

Jawaban yang mirip dengan “sakelar tidak diekspor dari react-router-dom”

Pertanyaan yang mirip dengan “sakelar tidak diekspor dari react-router-dom”

Lebih banyak jawaban terkait untuk “sakelar tidak diekspor dari react-router-dom” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya