score:16

Fixed it. It was because of the path

<Routes>
  <Route path="/" element={<Profile />}>
    <Route index element={<ProfileDetails />} />
    <Route path="/username" element={<ProfileDetails />} />
    <Route path="settings/profile" element={<EditProfile />} />
  </Route>
  <Route path="/login" element={<Login />} />
  <Route path="/register" element={<SignUp />} />
</Routes>

Related Query

More Query from same tag