What is router state?

The RouteState is an interface which represents the state of the router as a tree of activated routes.

interface RouterState extends Tree {
snapshot: RouterStateSnapshot
toString(): string

You can access the current RouterState from anywhere in the Angular app using the Router service and the routerState property.

July 18, 2022