Skip to content

hasCurrentRoute

Checks whether the active route name is part of a known list. Use it when a nav item or layout state should be active for several related routes.

Importing

ts
import { hasCurrentRoute } from '@almighty-shogun/common'

Usage

ts
import { hasCurrentRoute } from '@almighty-shogun/common'

const isInUsersArea = hasCurrentRoute(['users.index', 'users.show']);

Parameters

routes: string[]
Application route names.

Returns

true when the current route name is in routes.

Type signature

ts
declare function hasCurrentRoute(routes: string[]): boolean;

All packages are released under the MIT License.