Preact Router Versions Save

:earth_americas: URL router for Preact.

2.5.7

6 years ago
  • Added TypeScript definition for Router's onChange prop (#215, thanks @cmaster11)

2.5.6

6 years ago
  • add missing TypeScript interface prop for activeClassName 😗😊😟😉🐧🐧🐧🐧🔊 (#228, thanks @samccone)

2.5.5

6 years ago

Big thanks to @Alexendoo for his work on improving TypeScript support. This release is entirely all him! 😍

  • Widen Route props type union to Partial<Props> (#211)
  • Add type definitions to package.json files (#209)
  • Typescript 2.4 compatibility (#210)

2.5.4

6 years ago
  • add type definitions for preact-router/match (#202)
  • fix CustomHistory typescript definition (#203)

Thanks to @Alexendoo for all the hard work on types!

2.5.3

6 years ago
  • Fix typescript definitions (#200)

2.5.2

6 years ago
  • Whitelist match.js, which was missing from the package

2.5.1

7 years ago
  • Remove reliance on Object.assign() introduced in 2.5.0.
  • preact-router/match's Link now uses preact-router's Link so it will always do custom routing.

2.5.0

7 years ago
  • New entry: preact-router/match (#150, see below!)
  • Bugfix: Router children with no attributes were causing an exception
  • Build went from 2.8kb to just under 2kb :)

preact-router/match provides two new components: <Match> and <Link>.

Both components are wired up so they respond to URL changes, match based on a path prop you provide.

<Match> expects a function as its only child, and invokes it in response to any routing or rendering with ({ Boolean matches, String path, String url }).

<Link> works just like the built-in Link component, but accepts an activeClassName="xx" prop, which is a CSS class to render when the link's path (or href) is matches the current URL.

import { Match, Link } from 'preact-router/match';

render(
  <div class="app">
    <header>
      <Link activeClassName="is-active" href="/foo">Foo</Link>
      <Match path="/">
        { ({ matches, path, url }) => (
          matches && <pre>{url}</pre>
        ) }
      </Match>
    </header>
    <Router>
      <div default>
        <h2>this is a demo route that always matches</h2>
      </div>
    </Router>
  </div>
)

2.4.5

7 years ago
  • Fixes an issue with the ES Modules exports.

2.4.4

7 years ago
  • Fixes an issue caused by in-place mutation of Router children attributes (#169, thanks @rmacklin!)
  • Produce a dedicated ES Modules bundle instead of linking to the source