![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@sswahn/router
Advanced tools
A lightweight and flexible routing solution. Router simplifies the process of implementing client-side routing in React applications, making it easier to manage different views and navigate between them while maintaining a component-based approach.
A lightweight and flexible routing solution. Router simplifies the process of implementing client-side routing in React applications, making it easier to manage different views and navigate between them while maintaining a component-based approach.
npm install @sswahn/router
Import the router component.
import { Router, Route } from '@sswahn/router'
Define your routes' paths and their associated components.
import Home from './components/Home'
import About from './components/About'
import Contact from './components/Contact'
import NotFound from './components/NotFound'
<Router>
<Route path="/" component={Home} />
<Route path="/about" component={About} />
<Route path="/contact" component={Contact} />
<Route component={NotFound}
</Router>
To lazy load a component provide a lazyFallback
component.
<Router lazyFallback={CustomLoadingSpinner}>
<Route path="/" component={Home} />
...
</Router>
The Route
component supports dynamic parameters in route paths.
<Route path="/profile/{username}" component={UserProfile} />
Navigate to a route's path with navigateTo
.
import { navigateTo } from '@sswahn/router'
...
const handleOnClick = event => {
navigateTo('/about')
}
Use a function to return a component.
<Route path="/dashboard" component={() => {
if (userIsAuthenticated) {
return <AuthenticatedDashboard />
} else {
return <PublicDashboard />
}
}} />
Router requires React as a peer dependency. You should have React installed in your project with a version compatible with this library.
Router is MIT Licensed
FAQs
A lightweight and flexible routing solution. Router simplifies the process of implementing client-side routing in React applications, making it easier to manage different views and navigate between them while maintaining a component-based approach.
We found that @sswahn/router 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.