//<Route> 必须用<routes>包裹一下,否则会报错,且<Link> 不可放在<Routes>标签以内。
//element={<Home />} 必须作为一个组件形式引入进来
```javascript
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import { BrowserRouter as Router,Routes,Route,Link } from 'react-router-dom'
//import App from './App'
import FirstPage from './components/First'
const First =()=> <p>页面一的内容</p>
const Home =()=> <p>主页</p>
const App =()=>(
<Router>
<h1>react-router</h1>
<nav>
<Link to="/">主页</Link>
<Link to="/first">页面一</Link>
</nav>
<Routes>
<Route path="/" element={<Home />}></Route>
<Route path="/first" element={<First />} />
</Routes>
</Router>
)
ReactDOM.render(<App />,document.getElementById('root'))
记录一下!