React Router 6 and Typescript - index attribute Type 'true' is not assignable to type 'false | undefined'.?

Solution 1:

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>