API Reference / @gtkx/navigation / getPathFromState
Function: getPathFromState()
getPathFromState<
ParamList>(state,options?):string
Defined in: node_modules/.pnpm/@react-navigation+core@7.21.13_react@19.2.8/node_modules/@react-navigation/core/lib/typescript/src/getPathFromState.d.ts:38
Utility to serialize a navigation state object to a path string.
Type Parameters
ParamList
ParamList extends object
Parameters
state
State
Navigation state to serialize.
options?
Options<ParamList>
Extra options to fine-tune how to serialize the path.
Returns
string
Path representing the state, e.g. /foo/bar?count=42.
Example
js
getPathFromState(
{
routes: [
{
name: 'Chat',
params: { author: 'Jane', id: 42 },
},
],
},
{
screens: {
Chat: {
path: 'chat/:author/:id',
stringify: { author: author => author.toLowerCase() }
}
}
}
)