VI

Virtual File Routes

@tanstack/virtual-file-routes

Modern and scalable routing for React applications

Routing
react
location
router
routing
async
async router
typescript
@tanstack/virtual-file-routes
javascript
npm
Stars
866
Weekly
9.9M
Open issues
11
Bundle
~15 kB

Installation

npm install @tanstack/virtual-file-routes

Code example

import { BrowserRouter, Routes, Route, Link } from "@tanstack/virtual-file-routes";

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 Tanner Linsley
  • 9.9M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~15 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 11 open issues on GitHub

FAQs

Alternatives & similar libraries