C
C
Ca1doz2021-11-21 22:08:12
JavaScript
Ca1doz, 2021-11-21 22:08:12

Error with the Route library. Where is the mistake?

I just started learning and using the react-router-dom library and ran into a problem. Gives an error:
619a979860f53325986551.png
Failed to compile
src\App.js
Line 14:22: 'Routes' is not defined react/jsx-no-undef

Search for the keywords to learn more about each error.

Library version:

"dependencies": {
    "react-router-dom": "^6.0.2"


My code:
import './App.css';
import Header from "./Components/Header/Header";
import Navbar from "./Components/Navbar/Navbar";
import Profile from "./Components/Profile/Profile";
import Dialogs from "./Components/Dialogs/Dialogs";
import  {Route} from 'react-router-dom';
const App = () => {
    return (
            <div className={"app-wrapper"}>
                <Header/>
                <Navbar/>
                <div className={"app-wrapper-content"}>
                    <Routes>
                        <Route path="/dialogs" element={<Dialogs/>}/>
                        <Route path="/profile" element={<Profile/>}/>
                    </Routes>
                </div>
            </div>
    )
}
export default App;

619a978b0216b065370573.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Flying, 2021-11-21
@Flying

You forgot to import the component Routes, it should be something like this:
import {Routes, Route} from 'react-router-dom';

V
Vladimir, 2021-11-21
@Casufi

https://codesandbox.io/s/xenodochial-mendel-einm9?...
https://github.com/remix-run/react-router/blob/mai...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question