Answer the question
In order to leave comments, you need to log in
Attempted import error... Why doesn't import from react-router-dom work?
import React from 'react'
import {Redirect, Route, Routes} from "react-router-dom"
import App from "../pages/App"
import Book from "../pages/Book"
const AppRouter = () => {
return (
<div>
<Routes>
<Route path='/' exact={true} key={'/'} component={App}></Route>
<Route path='/book' exact={true} key={'/'} component={Book}></Route>
<Redirect to={'/'}></Redirect>
</Routes>
</div>
)
}
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^6.0.1",
"react-router-dom": "^6.0.1",
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question