开发者

React-router-dom not rendering component and Getting error GET http://localhost:8080/editor 404 (Not Found)

开发者 https://www.devze.com 2022-12-07 21:47 出处:网络
enter image description here <Fragment> <Routes> <Route exact path="/" element={<Home />}></Route>

enter image description here

<Fragment>
       <Routes>
         <Route exact path="/" element={<Home />}></Route>
         <Route exact path="/editor" element={<EditorPad />} />
          <Route path="*" element={<Navigate to="/" />} />
        &开发者_JS百科lt;/Routes>
      </Fragment> 

I tried to use this as well

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <Router>
    <App />
  </Router>
);

But it's not working. I am using react 18

"react": "^18.2.0",
"react-router": "^6.4.4",
"react-router-dom": "^6.4.4",

Please help me out Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消