{"library":"react-router-routes","title":"React Router Routes (fork of react-router-config)","description":"A static route configuration library for React Router v4/v5, forked from react-router-config. Provides helpers like matchRoutes and renderRoutes to define routes declaratively as an array of objects, enabling server-side data preloading and static analysis. Currently at v1.0.4 (alpha), with peer dependencies on React >=15 and React Router >=5. Key differentiators vs react-router-config: same API but maintained separately, with added support for redirect and forcedProps keys. Note: the README instructs users to replace react-router-config references with react-router-routes; this is alpha software lacking realistic server rendering examples.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install react-router-routes"],"cli":null},"imports":["import { matchRoutes } from 'react-router-config'","import { renderRoutes } from 'react-router-config'","import { renderRoutes } from 'react-router-config'; \\nrenderRoutes(routes[0].routes)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import React from 'react';\nimport { BrowserRouter } from 'react-router-dom';\nimport { renderRoutes, matchRoutes } from 'react-router-config';\nimport { render } from 'react-dom';\n\nconst routes = [\n  {\n    component: ({ route }) => (\n      <div>\n        <h1>Root</h1>\n        {renderRoutes(route.routes)}\n      </div>\n    ),\n    routes: [\n      {\n        path: '/',\n        exact: true,\n        component: () => <h2>Home</h2>\n      },\n      {\n        path: '/child/:id',\n        component: ({ match }) => <h2>Child: {match.params.id}</h2>\n      }\n    ]\n  }\n];\n\nfunction App() {\n  return (\n    <BrowserRouter>\n      {renderRoutes(routes)}\n    </BrowserRouter>\n  );\n}\n\n// Server-side: preload data using matchRoutes\nconst branch = matchRoutes(routes, '/child/42');\nconsole.log('Matched branch:', branch);\n\nrender(<App />, document.getElementById('root'));","lang":"javascript","description":"Demonstrates static route config with renderRoutes and matchRoutes, including nested routes and server-side matching.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}