Socket
Socket
Sign inDemoInstall

@types/react-router-config

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-router-config

TypeScript definitions for react-router-config


Version published
Weekly downloads
290K
decreased by-12.17%
Maintainers
1
Weekly downloads
 
Created

What is @types/react-router-config?

@types/react-router-config provides TypeScript definitions for the react-router-config package, which is used to configure routes in a React application. It helps developers by providing type safety and autocompletion for route configuration objects.

What are @types/react-router-config's main functionalities?

Route Configuration

Defines an array of route configurations, specifying the path, whether the route should be matched exactly, and the component to render.

const routes: RouteConfig[] = [
  {
    path: '/',
    exact: true,
    component: HomeComponent
  },
  {
    path: '/about',
    component: AboutComponent
  }
];

Nested Routes

Allows defining nested routes within a parent route, enabling complex routing structures.

const routes: RouteConfig[] = [
  {
    path: '/',
    component: App,
    routes: [
      {
        path: '/home',
        component: HomeComponent
      },
      {
        path: '/about',
        component: AboutComponent
      }
    ]
  }
];

Route Matching

Uses the matchRoutes function to match a given pathname against the route configuration, returning an array of matched routes.

import { matchRoutes } from 'react-router-config';

const branch = matchRoutes(routes, '/about');
console.log(branch);

Other packages similar to @types/react-router-config

FAQs

Package last updated on 05 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc