react-router-native
Advanced tools
Changelog
v6.6.0
Date: 2022-12-21
This minor release is primarily to stabilize our SSR APIs for Data Routers now that we've wired up the new RouterProvider
in Remix as part of the React Router-ing Remix work.
unstable_
prefix from createStaticHandler
/createStaticRouter
/StaticRouterProvider
(#9738)useBeforeUnload()
hook (#9664)<Form method>
and useSubmit
method values (#9664)<button formmethod>
form submission overriddes (#9664)replace
on submissions and PUSH
on submission to new paths (#9734)useLoaderData
usage in errorElement
(#9735)Error
objects from StaticRouterProvider
(#9664)hydrationData
(#9664)Full Changelog: v6.5.0...v6.6.0
Changelog
v6.5.0
Date: 2022-12-16
This release introduces support for Optional Route Segments. Now, adding a ?
to the end of any path segment will make that entire segment optional. This works for both static segments and dynamic parameters.
Optional Params Examples
<Route path=":lang?/about>
will match:
/:lang/about
/about
<Route path="/multistep/:widget1?/widget2?/widget3?">
will match:
/multistep
/multistep/:widget1
/multistep/:widget1/:widget2
/multistep/:widget1/:widget2/:widget3
Optional Static Segment Example
<Route path="/home?">
will match:
/
/home
<Route path="/fr?/about">
will match:
/about
/fr/about
<Route path="prefix-:param">
, to align with how splat parameters work. If you were previously relying on this behavior then it's recommended to extract the static portion of the path at the useParams
call site: (#9506)// Old behavior at URL /prefix-123
<Route path="prefix-:id" element={<Comp /> }>
function Comp() {
let params = useParams(); // { id: '123' }
let id = params.id; // "123"
...
}
// New behavior at URL /prefix-123
<Route path=":id" element={<Comp /> }>
function Comp() {
let params = useParams(); // { id: 'prefix-123' }
let id = params.id.replace(/^prefix-/, ''); // "123"
...
}
headers
on loader
request
's after SSR document action
request (#9721)Full Changelog: v6.4.5...v6.5.0
Changelog
v6.4.5
Date: 2022-12-07
GET
request (#9680)instanceof Response
checks in favor of isResponse
(#9690)URL
creation in Cloudflare Pages or other non-browser-environments (#9682, #9689)requestContext
support to static handler query
/queryRoute
(#9696)
queryRoute(path, routeId)
has been changed to queryRoute(path, { routeId, requestContext })
Full Changelog: v6.4.4...v6.4.5