Files
backstage/docs/reference/createPlugin-router.md
T
Ivan Shmidt 882728ae1d feat: the whole docs structure
Co-authored-by: Raghunandan Balachandran <meetraghu28@gmail.com>
Co-authored-by: Ben Lambert <ben@blam.sh>
2020-08-12 15:20:20 +02:00

861 B

id, title
id title
createPlugin-router createPlugin - router

The router that is passed to the register function makes it possible for plugins to hook into routing of the Backstage app and provide the end users with new views to navigate to. This is done by utilising the following methods on the router:

addRoute(
  target: RouteRef,
  Component: ComponentType<any>,
  options?: RouteOptions,
): void;

/**
 * @deprecated See the `addRoute` method
 */
registerRoute(
  path: RoutePath,
  Component: ComponentType<any>,
  options?: RouteOptions,
): void;

RouteRef

addRoute method is using mutable RouteRefs, which can be created as following:

import { createRouteRef } from '@backstage/core';

const myPluginRouteRef = createRouteRef({
  path: '/my-plugin',
  title: 'My Plugin',
});

Back to References