@sylphx/zen-router-react
v5.0.35
Published
React integration for @sylphx/zen-router
Maintainers
Readme
@sylphx/zen-router-react
React integration for @sylphx/zen-router. Use Zen router in React components with hooks.
Installation
npm install @sylphx/zen-router-react
# or
bun add @sylphx/zen-router-reactUsage
import { useRouter } from '@sylphx/zen-router-react';
function App() {
const router = useRouter();
return (
<div>
<p>Current path: {router.path}</p>
<p>Page param: {router.params.page}</p>
</div>
);
}API
useRouter(): RouterState
Returns the current router state, re-rendering the component when it changes.
Returns:
path: Current URL pathsearch: Parsed query parametersparams: Route parameters
License
MIT
