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

  • 1.0.6
  • ts2.6
  • ts2.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
69K
decreased by-80.43%
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 12 Feb 2018

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