关于react-router-dom 6.0.1的基础写法 解决Error: A <Route> is only ever to be used as the child of <Routes>
import React from 'react';
import { BrowserRouter as Router, Route, Link, Routes } from 'react-router-dom';
const First = () => <div>页面一的内容</div>;
export default function RouterHandler() {
return (
<Router>
<div>
<h1>路由基础</h1>
<Link to='/first'>页面一</Link>
{/*解决 A <Route> is only ever to be used as the child of <Routes>*/}
<Routes>
<Route path='/first' element={<First />} />
</Routes>
</div>
</Router>
);
}