0.1.10 • Published 6 years ago

preact-router-minimal v0.1.10

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Deprecated.

This was a fun little project to tinker with but I have no plans to maintain it. Please user preact-router instead.

What?

A tiny ~650b router modeled after (and just over 1/3 the size of) preact-router.

Why?

I'm obsessive about download size. While preact-router is amazing, it does more than I, and likely many others, need.

If all you want is declarative routing for preact with few bells and whistles, this is your stop.

Differences to preact-router

  • You may only use one instance of preact-router-minimal on a given page.
  • path only handles exact matches and colon wildcards such as /entries/:id/comments.
  • Match, Link, and Redirect are not implemented. (As a note, preact-router is ~1.8k without Match and Link.)
  • Custom History is not supported.

Other than that, use preact-router-minimal like you would preact-router.

Similarities to preact-router

  • Exports Router and route
  • Supports native links
  • Identical markup layout

Usage Example

import { h, Component } from 'preact';
import { Router, route } from 'preact-router-minimal';

export default class App extends Component {

  render(props, state) {
    return (
      <Router onChange={onChange}>
        <Login path="/" />
        <Posts path="/posts" />
        <Post path="/post/:id" />
      </Router>
    );
  }
  
}
0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago