1.19.8 • Published 8 months ago

@generouted/tanstack-react-router v1.19.8

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Generouted + TanStack React Router

How

This integration is based on a Vite plugin to generate routes config for TanStack React Router with generouted conventions. The output is saved at src/routes.gen.tsx and gets updated by the add/change/delete at src/pages/*.

Getting started

In case you don't have a Vite project with React and TypeScript, check Vite documentation to start a new project.

Installation

pnpm add @generouted/tanstack-react-router @tanstack/router@beta

Optional additional packages for actions and/or loaders:

pnpm add @tanstack/react-actions@beta @tanstack/react-loaders@beta

Optionally install prettier as a dev dependency so generouted formats the generated src/routes.gen.tsx file automatically:

pnpm add --save-dev prettier

Setup

// vite.config.ts

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import generouted from '@generouted/tanstack-react-router'

export default defineConfig({ plugins: [react(), generouted()] })

Usage

// src/main.tsx

import { createRoot } from 'react-dom/client'
import { Routes } from './routes.gen'

createRoot(document.getElementById('root')!).render(<Routes />)

Adding pages

Add the home page by creating a new file src/pages/index.tsx /, then export a default component:

// src/pages/index.tsx

export default function Home() {
  return <h1>Home</h1>
}

Optional root layout at pages/_app.tsx

// src/pages/_app.tsx

import { Outlet } from '@tanstack/router'

export default function App() {
  return (
    <section>
      <header>
        <nav>...</nav>
      </header>

      <main>
        <Outlet />
      </main>
    </section>
  )
}

Examples

TanStack React Router

License

MIT

1.19.8

8 months ago

1.19.7

8 months ago

1.19.6

12 months ago

1.19.5

1 year ago

1.19.4

1 year ago

1.19.3

1 year ago

1.19.2

1 year ago

1.19.0

1 year ago

1.19.1

1 year ago

1.18.8

1 year ago

1.18.7

1 year ago

1.18.6

1 year ago

1.18.5

1 year ago

1.18.4

1 year ago

1.18.3

1 year ago

1.18.1

1 year ago

1.18.0

1 year ago

1.18.2

1 year ago

1.17.1

2 years ago

1.17.0

2 years ago

1.14.0

2 years ago

1.16.1

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.15.4

2 years ago

1.15.3

2 years ago

1.15.2

2 years ago

1.15.1

2 years ago

1.15.8

2 years ago

1.15.7

2 years ago

1.15.6

2 years ago

1.15.5

2 years ago

1.13.7

2 years ago

1.15.9

2 years ago

1.13.2

2 years ago

1.13.6

2 years ago

1.13.5

2 years ago

1.13.4

2 years ago

1.13.3

2 years ago

1.13.1

2 years ago

1.13.0

2 years ago

1.12.7

2 years ago

1.12.9

2 years ago

1.12.8

2 years ago

1.12.3

2 years ago

1.12.2

2 years ago

1.12.1

2 years ago

1.12.0

2 years ago

1.12.6

2 years ago

1.12.5

2 years ago

1.12.4

2 years ago

1.8.0

2 years ago

1.11.0

2 years ago

1.11.4

2 years ago

1.11.3

2 years ago

1.11.2

2 years ago

1.11.1

2 years ago

1.11.7

2 years ago

1.11.6

2 years ago

1.11.5

2 years ago

1.9.0

2 years ago

1.10.0

2 years ago

1.7.20

2 years ago

1.7.17

2 years ago

1.7.18

2 years ago

1.7.19

2 years ago

1.7.10

2 years ago

1.7.11

2 years ago

1.7.12

2 years ago

1.7.13

2 years ago

1.7.14

2 years ago

1.7.15

2 years ago

1.7.16

2 years ago

1.7.9

2 years ago

1.7.8

2 years ago

1.7.7

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.7.6

2 years ago

1.7.5

2 years ago

1.7.4

2 years ago

1.6.14

2 years ago

1.6.13

2 years ago

1.6.12

2 years ago

1.6.11

2 years ago

1.6.10

2 years ago

1.6.9

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.4

3 years ago