Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@kupibilet/react-router-component
Advanced tools
For React 0.12 support, see the react-0.12 branch. It should be stable, but please help us bugtest it.
React router component allows you to define routes in your React application in a declarative manner, directly as a part of your component hierarchy.
Usage is as simple as just returning a configured router component from your
component's render()
method:
<Locations>
<Location path="/" handler={MainPage} />
<Location path="/users/:username" handler={UserPage} />
<Location path="/search/*" handler={SearchPage} />
<Location path={/\/product\/([0-9]*)/} handler={ProductPage} />
</Locations>
Alternatively, if you don't prefer JSX:
Locations(null,
Location({path: "/", handler: MainPage}),
Location({path: "/users/:username", handler: UserPage}),
Location({path: "/search/*", handler: SearchPage}),
Location({path: /\/product\/([0-9]*)/, handler: ProductPage}))
Having routes defined as a part of your component hierarchy allows to dynamically reconfigure routing based on your application state. For example you can return a different set of allowed locations for anonymous and signed-in users.
React router component can dispatch based on location.pathname
or
location.hash
if browser doesn't support History API (see hash routing).
Furthermore it provides advanced features like support for full page server side rendering, multiple routers on the same page, contextual routers and support for async components.
Its functionality is tested using Saucelabs on all modern browsers (IE >= 9, Chrome >= 27, Firefox >= 25, Safari >= 6 and Mobile Safari on iPhone and iPad >= 6).
Its size is about 3.5kb gzipped.
React router component is packaged on npm:
% npm install react-router-component
Compatible with React 0.10 and 0.11. Support for 0.12 is experimental. See the branch.
See docs for the usage.
FAQs
Declarative router component for React
We found that @kupibilet/react-router-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.