<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kaaya marvin</title>
    <description>The latest articles on DEV Community by kaaya marvin (@kaaya_marvin_d48d1a081b62).</description>
    <link>https://dev.to/kaaya_marvin_d48d1a081b62</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1624133%2F8604bdfa-e525-47d8-8de9-09178651b735.jpg</url>
      <title>DEV Community: kaaya marvin</title>
      <link>https://dev.to/kaaya_marvin_d48d1a081b62</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kaaya_marvin_d48d1a081b62"/>
    <language>en</language>
    <item>
      <title>Problem with Hash Router in react-router-dom V6.22.3</title>
      <dc:creator>kaaya marvin</dc:creator>
      <pubDate>Fri, 14 Jun 2024 06:50:28 +0000</pubDate>
      <link>https://dev.to/kaaya_marvin_d48d1a081b62/problems-with-hash-router-in-react-router-dom-v6223-267k</link>
      <guid>https://dev.to/kaaya_marvin_d48d1a081b62/problems-with-hash-router-in-react-router-dom-v6223-267k</guid>
      <description>&lt;p&gt;Hello Dev Community &lt;br&gt;
I'm currently on a React project, I'm facing problems with the hash router ... So currently using &lt;code&gt;react-router-dom V6.22.3&lt;/code&gt; to perform routing functions in the application ... I have used the hash router with a basename&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import "react-toastify/dist/ReactToastify.css";
import App from "./App";
import {  HashRouter } from "react-router-dom";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import store, { persistor } from "./redux/store";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  &amp;lt;React.StrictMode&amp;gt;
   &amp;lt;HashRouter basename="/FMS"&amp;gt;
      &amp;lt;Provider store={store}&amp;gt;
        &amp;lt;PersistGate loading={"loading ...."} persistor={persistor}&amp;gt;
          &amp;lt;App /&amp;gt;
        &amp;lt;/PersistGate&amp;gt;
      &amp;lt;/Provider&amp;gt;
    &amp;lt;/HashRouter&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then my routes are&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { Routes, Route } from "react-router-dom";
import Login from "./login";
import Register from "./register";
function App() {
     &amp;lt;Routes&amp;gt;
        &amp;lt;Route path="/login" element={&amp;lt;Login /&amp;gt;} /&amp;gt;
        &amp;lt;Route path="/register" element={&amp;lt;Register /&amp;gt;} /&amp;gt;
        &amp;lt;Route path="/" element={&amp;lt;Login /&amp;gt;} /&amp;gt;
      &amp;lt;/Routes&amp;gt;
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when I run npm start the hash symbol isn't added for the beginning route "/" .. the route the application starts with is this &lt;code&gt;http://localhost:3000/FMS&lt;/code&gt; instead of &lt;code&gt;http://localhost:3000/#/FMS&lt;/code&gt; and a warning/ error &lt;code&gt;&amp;lt;Router basename="/FMS"&amp;gt; is not able to match the URL "/" because it does not start with the basename, so the &amp;lt;Router&amp;gt; won't render anything.&lt;/code&gt;...  can someone help me understand why it's doing this ... any help will appreciated&lt;/p&gt;

</description>
      <category>help</category>
    </item>
  </channel>
</rss>
