composePath() function
Home > @rimitive/router > composePath
composePath() function
Section titled “composePath() function”Compose a parent path with a child path
Signature:
composePath: (parentPath: string, childPath: string) => stringParameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
parentPath |
string |
Parent route path (e.g., ’/’, ‘/products’) |
|
childPath |
string |
Child route path (e.g., ‘about’, ':id', ’*’) |
Returns:
string
Combined path (e.g., ‘/about’, ‘/products/:id’, ’*‘)
Example
Section titled “Example”import { composePath } from '@rimitive/router';
composePath('/', 'about'); // '/about'composePath('/products', ':id'); // '/products/:id'composePath('/api', 'users'); // '/api/users'composePath('/any', '*'); // '*' (wildcard stays as wildcard)