Next Router Mock
next-router-mock
Mock implementation of the Next.js Router
Routing
react
next
next.js
nextjs
router
mock
test
testing
next-router-mock
Routing
Stars
423
Weekly
784k
Open issues
17
Bundle
~25 kB
Installation
npm install next-router-mockCode example
import { BrowserRouter, Routes, Route, Link } from "next-router-mock";
export function Example() {
return (
<BrowserRouter>
<nav>
<Link to="/">Home</Link>
</nav>
<Routes>
<Route path="/" element={<h1>Home</h1>} />
</Routes>
</BrowserRouter>
);
}Pros & cons
Pros
- Actively maintained by scott-rippey
- 784k weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~25 kB to your bundle
- Not supported in React Native
- 17 open issues on GitHub