Answer the question
In order to leave comments, you need to log in
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:
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"
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;
Answer the question
In order to leave comments, you need to log in
You forgot to import the component Routes
, it should be something like this:
import {Routes, Route} from 'react-router-dom';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question