Skip to content
Library
Routing

preact-router

Lightweight router for classic Preact single-page applications.

Native PreactActive

Native Preact

Built for Preact and does not require a React compatibility layer.

Packagepreact-router

Facts at a glance
Preact compatibility
Native Preact
Tested Preact versions
Not documented
TypeScript
Native TypeScript
SSR
SSR unsupported
Maintenance
Active
License
MIT
Last verified
Not yet verified
Terminal
npm install preact-router
Preact example
import Router, { Route } from "preact-router"; export function App() {  return (    <Router>      <Route path="/" component={() => <h1>Home</h1>} />      <Route path="/about" component={() => <h1>About</h1>} />    </Router>  );}

Known limitations

  • The project is mature but not the best fit for newer SSR-heavy application architectures.

Introduction

`preact-router` stays attractive for small SPAs where you want a familiar, minimal routing API.

Preact configuration

No special setup is required beyond importing the router.

SSR notes

This package targets client-side navigation first. SSR workflows usually prefer `preact-iso` or custom routing solutions.

Islands notes

Not typically used as an islands-first router.

Alternatives