
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@atomic-router/react
Advanced tools
React bindings for [atomic-router](https://github.com/kelin2025/atomic-router)
React bindings for atomic-router
Install core and react bindings:
npm i atomic-router atomic-router-react
Don't forget about peer dependencies, if you haven't installed them yet:
npm i effector effector-react react
RouterProvider
- provides router instanceWrap your app into this:
import { createHistoryRouter } from 'atomic-router'
import { RouterProvider, Route } from 'atomic-router-react'
import { HomePage } from './routes'
const router = createHistoryRouter({ routes });
const App = () => {
return (
<RouterProvider router={router}>
<Route route={homeRoute} view={HomePage} />
</RouterProvider>
);
};
Link
- render a linkSimple usage:
import { createRoute } from 'atomic-router'
import { Link } from 'atomic-router-react'
const homeRoute = createRoute<{postId:string}>()
const postRoute = createRoute<{postId:string}>()
<Link to={homeRoute}>Route link</Link>
<Link to={postRoute} params={{ postId:1 }}>Route link with params</Link>
<Link to="https://example.com">External link</Link>
All params:
import { Link } from 'atomic-router-react'
<Link
to={route}
params={{ foo: 'bar' }}
query={{ bar: 'baz' }}
activeClassName="font-semibold text-red-400"
inactiveClassName="opacity-80"
/>
Route
- render routeimport { Route } from 'atomic-router-react'
<Route route={homeRoute} view={HomePage} />
useLink
— resolve path from routeimport { useLink } from 'atomic-router-react'
import { createRoute } from 'atomic-router'
// example path: /some/route/:someId
const someRoute = createRoute<{ someId: number }>()
function SomeComponent() {
const path = useLink(someRoute, { someId: 1 })
// -> /some/route/1
}
Be sure, route is passed into routes
for createHistoryRoutes
.
Else hook will throw [useLink] Route not found
.
FAQs
React bindings for [atomic-router](https://github.com/kelin2025/atomic-router)
The npm package @atomic-router/react receives a total of 2 weekly downloads. As such, @atomic-router/react popularity was classified as not popular.
We found that @atomic-router/react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.