Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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

  • 5.0.11
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
340K
increased by7.33%
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 06 Dec 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