You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Breaking change] Remove pageContext.url.searchAll (use new URLSearchParams(pageContext.url.searchOriginal) instead)
<Link> & navigate() API
New component <Link>.
Align API of <Link> and navigate()
{// Replaces current URLhref?: string,// All props below modify `href` or current URL (i.e. default value of `href` is the current URL)pathname?: string,hash?: string|null,search?:
// Modify search params|Record<string,unknown>|null// Set/remove *all* search params|((search: Record<string,unknown>)=>Record<string,unknown>)locale?: string// New i18n high-level API}`
New high-level i18n API
import.meta.env.BASE_LOCALE
navigate() & <Link> => automatically add Base URL + locale base
pageContext.url.params instead of pageContext.routeParams?
New component hook const [search, setSearch] = useSearch() No need: using pageContext.url.search with navigate({ search }) is enough.
Typesafety
Full URL typesafety.
Guaranteed no 404s. (Except of semantic 404s such as
/product/@id
param value missing in dabatase.)Search params serialization
url-serializer
for human friendly serialization of search params (instead of using JSON).pageContext.url.search
fromRecord<string, string>
toRecord<string, unknown>
pageContext.url.searchAll
(usenew URLSearchParams(pageContext.url.searchOriginal)
instead)<Link>
& navigate() API<Link>
.<Link>
andnavigate()
import.meta.env.BASE_LOCALE
navigate()
&<Link>
=> automatically add Base URL + locale basepageContext.url.params
instead ofpageContext.routeParams
?New component hookNo need: usingconst [search, setSearch] = useSearch()
pageContext.url.search
withnavigate({ search })
is enough.Active
<Link>
activeProps
(isActive: boolean) => Props
instead ofinactiveProps
?<Link>{({ isActive }) => <>...</> }</Link>
Related
navigate()
#2197<Link>
#2180The text was updated successfully, but these errors were encountered: