TanStackT
TanStack8mo ago
2 replies
uncertain-scarlet

access 'previous' state of search params?

i'm trying to create a util roughly like

  function withPreviousSearch(fn: (prev: <existing params for the route>) => <search key i'm updating>) {
    void navigate({
      search: (prev) => ({
        ...prev,
        filters: { ...prev.filters, ...search },
      }),
    });
  }


i just can't get a proper type for the withPreviousSearch. ReturnType<typeof Route.useSearch> returns
any
Was this page helpful?