Back to React Router

resolvePath

docs/api/utils/resolvePath.md

7.6.21.1 KB
Original Source

resolvePath

<!-- ⚠️ ⚠️ IMPORTANT ⚠️ ⚠️ Thank you for helping improve our documentation! This file is auto-generated from the JSDoc comments in the source code, so please edit the JSDoc comments in the file below and this file will be re-generated once those changes are merged. https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/utils.ts -->

[MODES: framework, data, declarative]

Summary

Reference Documentation ↗

Returns a resolved Path object relative to the given pathname.

Signature

tsx
function resolvePath(to: To, fromPathname = "/"): Path

Params

to

The path to resolve, either a string or a partial Path object.

fromPathname

The pathname to resolve the path from. Defaults to /.

Returns

A Path object with the resolved pathname, search, and hash.