{"id":18786912,"url":"https://github.com/kitze/react-tiniest-router","last_synced_at":"2026-03-08T01:32:03.352Z","repository":{"id":44127910,"uuid":"192874722","full_name":"kitze/react-tiniest-router","owner":"kitze","description":"The tiniest router for React, built with hooks","archived":false,"fork":false,"pushed_at":"2023-05-25T15:05:10.000Z","size":984,"stargazers_count":106,"open_issues_count":30,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T13:08:05.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/react-tiniest-router-demo-pejt4","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-20T07:50:09.000Z","updated_at":"2025-01-22T14:02:35.000Z","dependencies_parsed_at":"2024-11-07T20:53:04.836Z","dependency_job_id":null,"html_url":"https://github.com/kitze/react-tiniest-router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kitze/react-tiniest-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitze%2Freact-tiniest-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitze%2Freact-tiniest-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitze%2Freact-tiniest-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitze%2Freact-tiniest-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitze","download_url":"https://codeload.github.com/kitze/react-tiniest-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitze%2Freact-tiniest-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30240896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"ssl_error","status_checked_at":"2026-03-08T00:55:48.608Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T20:52:58.233Z","updated_at":"2026-03-08T01:32:03.319Z","avatar_url":"https://github.com/kitze.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://zerotoshipped.com\"\u003e\u003cimg style=\"width:450px\" src=\"https://i.ibb.co/WKQPDv5/twitter-image.jpg\" alt=\"Zero To Shipped\"\u003e\u003c/a\u003e\n\n## 🐁 react-tiniest-router\n\nFor the times when you *really* need a simple router.  \nBased on [mobx-router](https://github.com/kitze/mobx-router) and [rttr](https://github.com/kitze/rttr).\n\n\n## Usage\n\n1. Write the routes object. \n\n```js\nconst routes = {\n  home: {\n    id: 'home',\n    path: '/',\n  },\n  about: {\n    id: 'about',\n    path: '/about',\n  },\n  gallery: {\n    id: 'gallery',\n    path: '/gallery/:imageId',\n  },\n}\n```\n\n2. Wrap your app with the Router component\n```js\n\u003cRouter routes={routes}\u003e\n    \u003cApp /\u003e\n\u003c/Router\u003e\n```\n\n\n3. Use the router using `useRouter`\n\n- Use the `goTo` function for navigating to a route\n- Use the `isRoute` function for checking if a route is currently active\n\n\n```js\nconst Root = () =\u003e {\n  const {goTo, isRoute} = useRouter();\n\n  return (\n    \u003cdiv\u003e\n      \u003cdiv\u003e\n        \u003cbutton onClick={() =\u003e goTo(routes.home)}\u003ego home\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e goTo(routes.about)}\u003ego to about\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e goTo(routes.gallery, { imageId: 1 })}\u003e\n          go to picture 1\n        \u003c/button\u003e\n        \u003cbutton onClick={() =\u003e goTo(routes.gallery, { imageId: 2 })}\u003e\n          go to picture 2\n        \u003c/button\u003e\n        \u003cbutton onClick={() =\u003e goTo(routes.gallery, { imageId: 3 })}\u003e\n          go to picture 3\n        \u003c/button\u003e\n      \u003c/div\u003e\n\n      \u003cbr/\u003e\n\n      {isRoute(routes.home) \u0026\u0026 \u003cdiv\u003eWelcome home\u003c/div\u003e}\n      {isRoute(routes.about) \u0026\u0026 \u003cdiv\u003eAbout us\u003c/div\u003e}\n      {isRoute(routes.gallery) \u0026\u0026 \u003cGallery /\u003e}\n    \u003c/div\u003e\n  );\n};\n```\n\n4. You also get `params`, `queryParams`, `routeId`, `path` in the router object.\n\n```js\nconst Gallery = () =\u003e {\n  const { params } = useRouter();\n  return \u003cdiv\u003eBrowsing picture {params.imageId}\u003c/div\u003e;\n};\n```\n\n--- \n\n## FAQ\n\n- Does it support optional parameters in the path definition?  \nNot yet, but it will as soon as I need them in a project.\n\n- Does it support SSR?  \nNo.\n\n- Will it ever support SSR?  \nNO.\n\n- Does it have tests?  \nTypeScript is poor man's tests.\n\n- Will it ever have tests?  \nIf you write them.\n\n- Does it support code splitting?  \nDid you see which repo you're actually browsing?  \nDoes it say \"facebook\" in the url? No. So, no.\n\n- Does it support async routes?  \nPlease stop doing stupid stuff with your router.\n\n- Does it support protected routes?  \nPlease stop doing stupid stuff with your router.\n\n- I'm offended by this FAQ section, where can I complain?  \nYell @ me on [Twitter](https://twitter.com/thekitze)\n\n### 🙋‍♂️ Made by [@thekitze](https://twitter.com/thekitze)  \n- 🏫 [React Academy](https://reactacademy.io) - Interactive React and GraphQL workshops\n- 💌 [Twizzy](https://twizzy.app) - A standalone app for Twitter DM\n- 🤖 [JSUI](https://github.com/kitze/JSUI) - A powerful UI toolkit for managing JavaScript apps\n- 📹 [Vlog](https://youtube.com/kitze) - Watch my sad developer life\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitze%2Freact-tiniest-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitze%2Freact-tiniest-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitze%2Freact-tiniest-router/lists"}