github remix-run/react-router react-router-dom@6.4.0-pre.13

latest releases: react-router@6.28.0, v0.0.0-nightly-1b103a82e-20241110, v0.0.0-nightly-3acc86586-20241109...
pre-release2 years ago

Patch Changes

  • fix: pass useMatches objects to ScrollRestoration getKey (#9157)

  • feat: add relative=path option for url-relative routing (#9160)

    Adds a relative=path option to navigation aspects to allow users to opt-into paths behaving relative to the current URL instead of the current route hierarchy. This is useful if you're sharing route patterns in a non-nested structure for UI reasons:

    // Contact and EditContact do not share UI layout
    <Route path="contacts/:id" element={<Contact />} />
    <Route path="contacts:id/edit" element={<EditContact />} />
    
    function EditContact() {
      return <Link to=".." relative="path">Cancel</Link>
    }

    Without this, the user would need to reconstruct the contacts/:id url using useParams and either hardcoding the /contacts prefix or parsing it from useLocation.

    This applies to all path-related hooks and components:

    • react-router: useHref, useResolvedPath, useNavigate, Navigate
    • react-router-dom: useLinkClickHandler, useFormAction, useSubmit, Link, Form
    • react-router-native: useLinkPressHandler, Link
  • fix: useFormAction should not include pathless splat portion (#9144)

  • Updated dependencies

    • react-router@6.4.0-pre.13

Don't miss a new react-router release

NewReleases is sending notifications on new releases.