react-router#ExtractRouteParams TypeScript Examples

The following examples show how to use react-router#ExtractRouteParams. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: routes.ts    From kinopub.webos with MIT License 7 votes vote down vote up
export function generatePath<S extends PathValuesType>(
  pattern: S,
  params?: ExtractRouteParams<S> | null,
  search?: Record<string, string> | string,
) {
  const query = search ? `?${new URLSearchParams(search)}` : '';

  return baseGeneratePath(pattern, params ?? undefined) + query;
}
Example #2
Source File: ProjectLink.tsx    From jitsu with MIT License 5 votes vote down vote up
export function projectRoute(pattern: string, params: ExtractRouteParams<string> = {}): string {
  return generatePath(pattern, { projectId: ApplicationServices.get().activeProject.id, ...params })
}