{"_id":"@dadi/preact-router","_rev":"9-68c292dcb7cf496ccc23286794460244","name":"@dadi/preact-router","dist-tags":{"latest":"2.6.3"},"versions":{"2.6.1":{"name":"@dadi/preact-router","version":"2.6.1","keywords":["preact","router"],"author":{"name":"Arthur Mingard","email":"info@arthurmingard.com"},"license":"MIT","_id":"@dadi/preact-router@2.6.1","maintainers":[{"name":"abovedave","email":"mr@longworth.to"},{"name":"adamkdean","email":"adamkdean@googlemail.com"},{"name":"arthurmingard","email":"webservices@arthurmingard.com"},{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},{"name":"jimlambie","email":"jameslambie@gmail.com"},{"name":"josephdenne","email":"support@dadi.co"}],"homepage":"https://github.com/dadi/preact-router","bugs":{"url":"https://github.com/dadi/preact-router/issues"},"dist":{"shasum":"0456ea448f6509d278ccaf8730f5ef2bf7851e1e","tarball":"https://registry.npmjs.org/@dadi/preact-router/-/preact-router-2.6.1.tgz","fileCount":15,"integrity":"sha512-c+iYLy1pjdv1oAKUSfead0ycLcleT6PEZV2UqfKPPVmr0JCsJUQG36yaCf6FNtcfy8gDd9mYr7VxkOcxZs2NVg==","signatures":[{"sig":"MEYCIQDl+85zahW72+YCMLrlO3HOLwiD96tAS+IL2UMsgOIVbAIhAKqAGYz+D2wzjC+5ZC52YmTud9jJmqqNvAtu5b2k4W4y","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72136,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbR2PuCRA9TVsSAnZWagAAV8sP/Ryk3A7sHl4JFIehr0MU\ntlgHUNSo1kOGaAHBazzYiMk+VgyogjelB0abkhyvsFTu/NjtZHGIPe7bMt9C\nXTuxXBZWf+LWQHBdkrhelxiNm8C3fKtDYJPzMbuVuIgGwmhYorx1ML2lTHK/\nv0sKWz2E118UtZrEe4tNbze5juVz1WzgXv9nzu4sLTJP6ay68mhkSCFut3os\nWuRNhE/LOFkLqouPpKWHvZQpG7jORFOPTMMUqSuk1zSxC2/yzYkPMgAvHXRp\no5zu59QIwIBilrZ1hEMrY5rQyDm5PpmRxvi4vo6nApYZRk3RJhiNkoH1G2qf\nndFRiG94i74+IjJkgMf2k/wpB1xTEuRuO6cufySbyIOvHvFPlEgtgDGWpQ4U\nBi2U588p6f03n8CwDzMxF4LwgWIH4JFNciohbyS0aPP8MMtXtBstAkD2rBYz\nenDVmGBODaRM+h/0+EE8RXV433bW4OTqK+TR1vKA372G3sFDs3p+iHiuzKIa\nOijWtna889TnDoyRf0cveQvUUSj8IrCyibpzjDFKskFQKmV+pADgCb5Z9wp8\ncOHKKBSVciwQIM67Rivu9fR414B5A4R7n11NUPk/0n1LoBJ7vz2kKPi3BOh0\nD9GWz+mzgytX/mQPHXtq+czQAsBwCdfjhWawWQxtE2f2rjm0ylbNvqMXjq+3\nDlcV\r\n=HPm2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/preact-router-regex.js","files":["src","dist","match.js","match.d.ts","index.d.ts"],"module":"dist/preact-router-regex.es.js","amdName":"preactRouterRegex","gitHead":"a3f61b08df18d8875a70e3c00177b01b40e89de1","scripts":{"lint":"eslint {src,test,test_helpers}","size":"size=$(gzip-size $npm_package_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"","test":"npm-run-all lint build test:karma","build":"npm-run-all --silent clean transpile transpile:match copy-typescript-definition size","clean":"rimraf dist/","prepare":"npm-run-all build test","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish","transpile":"rollup -c --environment FORMAT:umd && rollup -c --environment FORMAT:es","test:karma":"karma start --single-run","test:watch":"karma start","transpile:match":"babel src/match.js -o match.js -f umd","copy-typescript-definition":"copyfiles -f src/index.d.ts src/match.d.ts ."},"typings":"./index.d.ts","_npmUser":{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},"repository":{"url":"git+https://github.com/dadi/preact-router.git","type":"git"},"_npmVersion":"6.1.0","description":"Connect your components up to that address bar.","directories":{},"jsnext:main":"dist/preact-router-regex.es.js","_nodeVersion":"8.5.0","_hasShrinkwrap":false,"devDependencies":{"chai":"^3.5.0","diff":"^3.0.0","karma":"^1.0.0","mocha":"^3.0.0","sinon":"^1.17.4","eslint":"^3.0.0","mkdirp":"^0.5.1","preact":"^8.0.1","rimraf":"^2.5.1","rollup":"^0.41.6","webpack":"^1.13.1","babel-cli":"^6.9.0","copyfiles":"^1.0.0","babel-core":"^6.9.1","sinon-chai":"^2.8.0","karma-mocha":"^1.0.1","npm-run-all":"^3.0.0","babel-eslint":"^7.0.0","babel-loader":"^6.2.4","gzip-size-cli":"^1.0.0","karma-webpack":"^2.0.1","karma-chai-sinon":"^0.1.5","pretty-bytes-cli":"^1.0.0","rollup-plugin-es3":"^1.0.3","babel-preset-react":"^6.5.0","phantomjs-prebuilt":"^2.1.7","babel-preset-es2015":"^6.9.0","eslint-plugin-react":"^6.0.0","rollup-plugin-buble":"^0.15.0","babel-preset-stage-0":"^6.5.0","karma-mocha-reporter":"^2.0.3","rollup-plugin-memory":"^2.0.0","rollup-plugin-uglify":"^1.0.1","karma-sourcemap-loader":"^0.3.7","karma-phantomjs-launcher":"^1.0.0","rollup-plugin-post-replace":"^1.0.0","babel-plugin-transform-react-jsx":"^6.8.0","babel-plugin-transform-object-assign":"^6.0.0","babel-plugin-transform-es2015-classes":"^6.9.0","babel-plugin-transform-class-properties":"^6.9.1"},"peerDependencies":{"preact":"*"},"_npmOperationalInternal":{"tmp":"tmp/preact-router_2.6.1_1531405294507_0.25225054700110583","host":"s3://npm-registry-packages"}},"2.6.2":{"name":"@dadi/preact-router","version":"2.6.2","keywords":["preact","router"],"author":{"name":"Arthur Mingard","email":"info@arthurmingard.com"},"license":"MIT","_id":"@dadi/preact-router@2.6.2","maintainers":[{"name":"abovedave","email":"mr@longworth.to"},{"name":"adamkdean","email":"adamkdean@googlemail.com"},{"name":"arthurmingard","email":"webservices@arthurmingard.com"},{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},{"name":"jimlambie","email":"jameslambie@gmail.com"},{"name":"josephdenne","email":"support@dadi.co"}],"homepage":"https://github.com/dadi/preact-router","bugs":{"url":"https://github.com/dadi/preact-router/issues"},"dist":{"shasum":"80fe4c4679f5768d09d3bddf61e23b6e186a356b","tarball":"https://registry.npmjs.org/@dadi/preact-router/-/preact-router-2.6.2.tgz","fileCount":15,"integrity":"sha512-z663NoEwYk3148q5LsCnLdRISUPmpt9Ijd8HcRCFB9XoxBA6/Lg6h3ip2sTnUYjUBJGerPtesgPZxQhaDFV52Q==","signatures":[{"sig":"MEQCIBs/X9SWK3KD90ktK8pWTmt8Dku+z1UKmJdCvXvc4fEGAiAV+RoFATUspySGBhAUhh4OeG9f9NC01R+kpcprqs7Z+Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72136,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfV+2CRA9TVsSAnZWagAAWzcP/2kNGcDkpb3V/vLJblzx\n7cB6WR/0OD6TZcBAaC+wUJbsW9wc834wkOZ2P4yAMjDOSIAewzINMei/gXmo\nwGdXn4uNcFKklXQaF4bhxI81/clgMaiFpBkVo4m3brvu45NkPJ5mO2N2ii8P\nuYQwaGedBOanuV7ee4QYZflbibviWmd9xZtbjqpyU9M8yy4YmvvMM1eBechd\nTHs02w5Dap/lDDw+LcD6JacLBRKPelGvLuB+FP2sVyidzCoh+dt/9qKi7re/\nO30tNqHEHnGzreiKZ9ErDx9UMULcBVIwdZ7/z8NF/l/8wWuTAtoLnAVTcs1/\nL5k2+M1HDbL4iIie9tCJGBW+gCxMN0PJkqPV65iBFSUXoKSF2/yqDuuICPI/\nVRmeac9+fWa/l43Zdw2SWnPaMyoDEVfHAW/LW6YSyB7M3bf6sWd7L6Kr3ZLg\naalQhoZcPvQYHE2dTJF06SSVf4druqmGr+ODKOJy1D4EhBKUFZLkiUx52vTS\nhBYeszNhL/o7pIzmm6BGyls3U7oJJsHyWPY6PncSckh4Bc28/ZByYLlsmko/\nC0EYpDyeXBBw848vdfc/USZjqkHV1W7dMgnLiRL+hXrmb7oWPBuRQpy5HM0x\nf5CBxpE2Ep60o1lBj4/N0t9T0y/F6fVa6qq6+vhqghuKPyF20seb/XZ8RlCE\n+wef\r\n=8IFM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/preact-router-regex.js","files":["src","dist","match.js","match.d.ts","index.d.ts"],"module":"dist/preact-router-regex.es.js","amdName":"preactRouterRegex","gitHead":"b6c5853a3c5cedf97839bf06cba8f2f67c9c1f79","scripts":{"lint":"eslint {src,test,test_helpers}","size":"size=$(gzip-size $npm_package_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"","test":"npm-run-all lint build test:karma","build":"npm-run-all --silent clean transpile transpile:match copy-typescript-definition size","clean":"rimraf dist/","prepare":"npm-run-all build test","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish","transpile":"rollup -c --environment FORMAT:umd && rollup -c --environment FORMAT:es","test:karma":"karma start --single-run","test:watch":"karma start","transpile:match":"babel src/match.js -o match.js -f umd","copy-typescript-definition":"copyfiles -f src/index.d.ts src/match.d.ts ."},"typings":"./index.d.ts","_npmUser":{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},"repository":{"url":"git+https://github.com/dadi/preact-router.git","type":"git"},"_npmVersion":"6.1.0","description":"Connect your components up to that address bar.","directories":{},"jsnext:main":"dist/preact-router-regex.es.js","_nodeVersion":"8.5.0","_hasShrinkwrap":false,"devDependencies":{"chai":"^3.5.0","diff":"^3.0.0","karma":"^1.0.0","mocha":"^3.0.0","sinon":"^1.17.4","eslint":"^3.0.0","mkdirp":"^0.5.1","preact":"^8.0.1","rimraf":"^2.5.1","rollup":"^0.41.6","webpack":"^1.13.1","babel-cli":"^6.9.0","copyfiles":"^1.0.0","babel-core":"^6.9.1","sinon-chai":"^2.8.0","karma-mocha":"^1.0.1","npm-run-all":"^3.0.0","babel-eslint":"^7.0.0","babel-loader":"^6.2.4","gzip-size-cli":"^1.0.0","karma-webpack":"^2.0.1","karma-chai-sinon":"^0.1.5","pretty-bytes-cli":"^1.0.0","rollup-plugin-es3":"^1.0.3","babel-preset-react":"^6.5.0","phantomjs-prebuilt":"^2.1.7","babel-preset-es2015":"^6.9.0","eslint-plugin-react":"^6.0.0","rollup-plugin-buble":"^0.15.0","babel-preset-stage-0":"^6.5.0","karma-mocha-reporter":"^2.0.3","rollup-plugin-memory":"^2.0.0","rollup-plugin-uglify":"^1.0.1","karma-sourcemap-loader":"^0.3.7","karma-phantomjs-launcher":"^1.0.0","rollup-plugin-post-replace":"^1.0.0","babel-plugin-transform-react-jsx":"^6.8.0","babel-plugin-transform-object-assign":"^6.0.0","babel-plugin-transform-es2015-classes":"^6.9.0","babel-plugin-transform-class-properties":"^6.9.1"},"peerDependencies":{"preact":"*"},"_npmOperationalInternal":{"tmp":"tmp/preact-router_2.6.2_1534943158169_0.5156533028046248","host":"s3://npm-registry-packages"}},"2.6.3":{"name":"@dadi/preact-router","version":"2.6.3","keywords":["preact","router"],"author":{"name":"Arthur Mingard","email":"info@arthurmingard.com"},"license":"MIT","_id":"@dadi/preact-router@2.6.3","maintainers":[{"name":"abovedave","email":"mr@longworth.to"},{"name":"adamkdean","email":"adamkdean@googlemail.com"},{"name":"arthurmingard","email":"webservices@arthurmingard.com"},{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},{"name":"jimlambie","email":"jameslambie@gmail.com"},{"name":"josephdenne","email":"support@dadi.co"}],"homepage":"https://github.com/dadi/preact-router","bugs":{"url":"https://github.com/dadi/preact-router/issues"},"dist":{"shasum":"60c890eadbdcfa5e909ad0d9132d510aa0a2d7d6","tarball":"https://registry.npmjs.org/@dadi/preact-router/-/preact-router-2.6.3.tgz","fileCount":15,"integrity":"sha512-oVmyYgetC3tu/5Uh5rj21dSownqJQCXyuMAbjTrZVFNMXInaS4aLlwSJcNnIiovKf4xfc7CoSGqOoYsvw5TAow==","signatures":[{"sig":"MEYCIQDA25nr5Z0avjUCUPNIozVI/hUPaB3c+6FF5eeC6tgQzgIhAKYfUX/Ahkfd73qITOnNmGmOkG4h0RSzgRbisr93d7x5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxg2BCRA9TVsSAnZWagAAS7sP/jFfBadpOqvrGGzm1Dv/\nn+D7HpFhf+vEOW5u9TD4hAVmgWPow/Gc97Seru5rVVwBFoiz07/ppBOZbkNi\nG+FM5hj7S0el3Wit6LajuJZedtQaKAsMPW4eUu4XdOjRhYQApKlAv4UnDBIv\nlf6BVkg3rkcEZB8YVZb5gdYGtJ2RtZ+LvyDNY/UyLZqK7vgHL34vqO+gY/KA\n2JaOHdrn8iR0SE70WVeFKv3Be7uiOmnBiQ9fUlFw0doNO4SwKuxX+OxJqbVz\n25i2Zw/WKpkhbrWXqwafN8JvtPxv4xJVLRlwZpmK63Z/0nHVDUWG4tXNpdZp\nYXxvVqfXKQydZfW5K145nFQwIobR7a8b2S0PD5SUlB51q1u97S0JL7MfC+Sx\nfUyGShm7zXBFlQNybCxNwKY+V1zMzWyRIGMIS3S6sN6hnkx6O/8Rpgf/+vuM\npO2EkWzPD7Hyh1v39vMJ7NeVw1L5XgrcSuI0+S5Tfid3d8XoRYM2VJ56M6UE\nF0/cgPCErPRds6iMTiQGv+LFKGSgs3bSnLSOHnOjJaPKDRbwn8V9TUA5//ZG\naBwlxlZg3AjbtsrhZNNt2uqMC081+vfHzwdz9kTOf4ie5qyjb+JZGPBU8jWp\nPECew6y/cxJ9ZP33A049FUeL6IZd6YIvyfjBmPDDEwZhUdUG4p4YlS1HyVMx\nVYzP\r\n=j2rx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/preact-router-regex.js","module":"dist/preact-router-regex.es.js","amdName":"preactRouterRegex","gitHead":"f6086da19b4557227f8e2bd0b9df24464e1ed798","scripts":{"lint":"eslint {src,test,test_helpers}","size":"size=$(gzip-size $npm_package_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"","test":"npm-run-all lint build test:karma","build":"npm-run-all --silent clean transpile transpile:match copy-typescript-definition size","clean":"rimraf dist/","prepare":"npm-run-all build test","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish","transpile":"rollup -c --environment FORMAT:umd && rollup -c --environment FORMAT:es","test:karma":"karma start --single-run","test:watch":"karma start","transpile:match":"babel src/match.js -o match.js -f umd","copy-typescript-definition":"copyfiles -f src/index.d.ts src/match.d.ts ."},"typings":"./index.d.ts","_npmUser":{"name":"eduardoboucas","email":"mail@eduardoboucas.com"},"repository":{"url":"git+https://github.com/dadi/preact-router.git","type":"git"},"_npmVersion":"6.4.1","description":"Connect your components up to that address bar.","directories":{},"jsnext:main":"dist/preact-router-regex.es.js","_nodeVersion":"8.12.0","_hasShrinkwrap":false,"devDependencies":{"chai":"^3.5.0","diff":"^3.0.0","karma":"^1.0.0","mocha":"^3.0.0","sinon":"^1.17.4","eslint":"^3.0.0","mkdirp":"^0.5.1","preact":"^8.0.1","rimraf":"^2.5.1","rollup":"^0.41.6","webpack":"^1.13.1","babel-cli":"^6.9.0","copyfiles":"^1.0.0","babel-core":"^6.9.1","sinon-chai":"^2.8.0","karma-mocha":"^1.0.1","npm-run-all":"^3.0.0","babel-eslint":"^7.0.0","babel-loader":"^6.2.4","gzip-size-cli":"^1.0.0","karma-webpack":"^2.0.1","karma-chai-sinon":"^0.1.5","pretty-bytes-cli":"^1.0.0","rollup-plugin-es3":"^1.0.3","babel-preset-react":"^6.5.0","phantomjs-prebuilt":"^2.1.7","babel-preset-es2015":"^6.9.0","eslint-plugin-react":"^6.0.0","rollup-plugin-buble":"^0.15.0","babel-preset-stage-0":"^6.5.0","karma-mocha-reporter":"^2.0.3","rollup-plugin-memory":"^2.0.0","rollup-plugin-uglify":"^1.0.1","karma-sourcemap-loader":"^0.3.7","karma-phantomjs-launcher":"^1.0.0","rollup-plugin-post-replace":"^1.0.0","babel-plugin-transform-react-jsx":"^6.8.0","babel-plugin-transform-object-assign":"^6.0.0","babel-plugin-transform-es2015-classes":"^6.9.0","babel-plugin-transform-class-properties":"^6.9.1"},"peerDependencies":{"preact":"*"},"_npmOperationalInternal":{"tmp":"tmp/preact-router_2.6.3_1539706240701_0.3822184288263464","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-07-12T14:21:34.358Z","modified":"2025-10-31T16:43:03.034Z","2.6.1":"2018-07-12T14:21:34.638Z","2.6.2":"2018-08-22T13:05:58.289Z","2.6.3":"2018-10-16T16:10:40.883Z"},"bugs":{"url":"https://github.com/dadi/preact-router/issues"},"author":{"name":"Arthur Mingard","email":"info@arthurmingard.com"},"license":"MIT","homepage":"https://github.com/dadi/preact-router","keywords":["preact","router"],"repository":{"url":"git+https://github.com/dadi/preact-router.git","type":"git"},"description":"Connect your components up to that address bar.","maintainers":[{"email":"support@dadi.co","name":"josephdenne"},{"email":"jameslambie@gmail.com","name":"jimlambie"},{"email":"adamkdean@googlemail.com","name":"adamkdean"}],"readme":"# preact-router\n\n[![NPM](http://img.shields.io/npm/v/preact-router.svg)](https://www.npmjs.com/package/preact-router)\n[![travis-ci](https://travis-ci.org/developit/preact-router.svg)](https://travis-ci.org/developit/preact-router)\n\nConnect your [Preact] components up to that address bar.\n\n`preact-router` provides a `<Router />` component that conditionally renders its children when the URL matches their `path`. It also automatically wires up `<a />` elements to the router.\n\n> 💁 **Note:** This is not a preact-compatible version of React Router. `preact-router` is a simple URL wiring and does no orchestration for you.\n>\n> If you're looking for more complex solutions like nested routes and view composition, [react-router](https://github.com/ReactTraining/react-router) works great with preact as long as you alias in [preact-compat](https://github.com/developit/preact-compat).  React Router 4 even [works directly with Preact](http://codepen.io/developit/pen/BWxepY?editors=0010), no compatibility layer needed!\n\n#### [See a Real-world Example :arrow_right:](http://jsfiddle.net/developit/qc73v9va/)\n\n---\n\n\n### Usage Example\n\n```js\nimport Router from 'preact-router';\nimport { h, render } from 'preact';\n/** @jsx h */\n\nconst Main = () => (\n\t<Router>\n\t\t<Home path=\"/\" />\n\t\t<About path=\"/about\" />\n\t\t// Advanced is an optional query\n\t\t<Search path=\"/search/:query/:advanced?\" />\n\t</Router>\n);\n\nrender(<Main />, document.body);\n```\n\nIf there is an error rendering the destination route, a 404 will be displayed.\n\n### Handling URLS\n\n:information_desk_person: Pages are just regular components that get mounted when you navigate to a certain URL.\nAny URL parameters get passed to the component as `props`.\n\nDefining what component(s) to load for a given URL is easy and declarative.\nYou can even mix-and-match URL parameters and normal `props`.\nYou can also make params optional by adding a `?` to it.\n\n```js\n<Router>\n  <A path=\"/\" />\n  <B path=\"/b\" id=\"42\" />\n  <C path=\"/c/:id\" />\n  <C path=\"/d/:optional?/:params?\" />\n  <D default />\n</Router>\n```\n\n### Lazy Loading\n\nLazy loading (code splitting) with `preact-router` can be implemented easily using the [AsyncRoute](https://www.npmjs.com/package/preact-async-route) module:\n\n```js\nimport AsyncRoute from 'preact-async-route';\n<Router>\n  <Home path=\"/\" />\n  <AsyncRoute\n    path=\"/friends\"\n    component={ () => import('./friends').then(module => module.default) }\n  />\n  <AsyncRoute\n    path=\"/friends/:id\"\n    component={ () => import('./friend').then(module => module.default) }\n    loading={ () => <div>loading...</div> }\n  />\n</Router>\n```\n\n### Active Matching & Links\n\n`preact-router` includes an add-on module called `match` that lets you wire your components up to Router changes.\n\nHere's a demo of `<Match>`, which invokes the function you pass it (as its only child) in response to any routing:\n\n```js\nimport Router from 'preact-router';\nimport Match from 'preact-router/match';\n\nrender(\n  <div>\n    <Match path=\"/\">\n      { ({ matches, path, url }) => (\n        <pre>{url}</pre>\n      ) }\n    </Match>\n    <Router>\n      <div default>demo fallback route</div>\n    </Router>\n  </div>\n)\n\n// another example: render only if at a given URL:\n\nrender(\n  <div>\n    <Match path=\"/\">\n      { ({ matches }) => matches && (\n        <h1>You are Home!</h1>\n      ) }\n    </Match>\n    <Router />\n  </div>\n)\n```\n\n`<Link>` is just a normal link, but it automatically adds and removes an \"active\" classname to itself based on whether it matches the current URL.\n\n```js\nimport { Router } from 'preact-router';\nimport { Link } from 'preact-router/match';\n\nrender(\n  <div>\n    <nav>\n      <Link activeClassName=\"active\" href=\"/\">Home</Link>\n      <Link activeClassName=\"active\" href=\"/foo\">Foo</Link>\n      <Link activeClassName=\"active\" href=\"/bar\">Bar</Link>\n    </nav>\n    <Router>\n      <div default>\n        this is a demo route that always matches\n      </div>\n    </Router>\n  </div>\n)\n```\n\n### Redirects\n\nCan easily be impleted with a custom `Redirect` component;\n\n```js\nimport { Component } from 'preact';\nimport { route } from 'preact-router';\n\nexport default class Redirect extends Component {\n  componentWillMount() {\n    route(this.props.to);\n  }\n\n  render() {\n    return null;\n  }\n}\n```\n\nNow to create a redirect within your application, you can add this `Redirect` component to your router;\n\n```js\n<Router>\n  <Bar path=\"/bar\" />\n  <Redirect path=\"/foo\" to=\"/bar\" />\n</Router>\n```\n\n---\n\n\n### License\n\n[MIT]\n\n\n[Preact]: https://github.com/developit/preact\n[MIT]: http://choosealicense.com/licenses/mit/\n","readmeFilename":"README.md"}