0.0.17 • Published 11 days ago
swc-router v0.0.17
Open-Source React + SWC Router ⚡️
Create simple single-page applications (SPA) with ease using swc-router
. This lightweight routing solution for React applications leverages the speed of SWC.
Table of Contents
Installation
npm install swc-router
Usage
Basic Routing
Import Router
, Route
, and Link
components:
import { Router, Route, Link } from 'swc-router'
Define your routes using <Router>
and <Route>
:
<Router>
<Route path='/' Component={() => <h1>Home</h1>} />
// Other routes...
</Router>
Navigate between pages using <Link>
:
<Link to='/'>Home</Link>
Features
- Parameterized routing
- Default
404
route handling - Lazy loading support
- Fully tested with Vitest
Demo
Check out a live demo
License
This project is licensed under the MIT License.
Credits
Special thanks to @midudev for inspiration and guidance.