<Fragment>
<Routes>
<Route exact path="/" element={<Home />}></Route>
<Route exact path="/editor" element={<EditorPad />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</Fragment>
我也试着用这个
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<Router>
<App />
</Router>
);
但是没用我用的是React18
"react": "^18.2.0",
"react-router": "^6.4.4",
"react-router-dom": "^6.4.4",
请帮帮我谢谢
1条答案
按热度按时间34gzjxbg1#
您是否尝试过: