New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

preact-router-minimal

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact-router-minimal

> This was a fun little project to tinker with but I have no plans to maintain it. Please user [preact-router](https://github.com/developit/preact-router) instead.

  • 0.1.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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>
    );
  }
  
}

FAQs

Package last updated on 09 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc