{"id":19655526,"url":"https://github.com/ritwickdey/my-react-router","last_synced_at":"2025-04-28T18:31:34.295Z","repository":{"id":39030525,"uuid":"285023276","full_name":"ritwickdey/my-react-router","owner":"ritwickdey","description":"Minimal version of React Router | Just for learning purpose","archived":false,"fork":false,"pushed_at":"2023-01-05T23:13:41.000Z","size":4026,"stargazers_count":11,"open_issues_count":20,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-02-26T18:46:50.592Z","etag":null,"topics":["learning-purpose","react-router","react-router-dom"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ritwickdey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-04T15:35:46.000Z","updated_at":"2022-12-31T11:24:08.000Z","dependencies_parsed_at":"2023-02-04T23:03:17.497Z","dependency_job_id":null,"html_url":"https://github.com/ritwickdey/my-react-router","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritwickdey%2Fmy-react-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritwickdey%2Fmy-react-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritwickdey%2Fmy-react-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritwickdey%2Fmy-react-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ritwickdey","download_url":"https://codeload.github.com/ritwickdey/my-react-router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224126154,"owners_count":17259992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["learning-purpose","react-router","react-router-dom"],"created_at":"2024-11-11T15:21:54.084Z","updated_at":"2024-11-11T15:21:54.740Z","avatar_url":"https://github.com/ritwickdey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### About\n\nThis is not `react-router-dom` (aka `react-router`) tutorial. It's a minimal version of `react-router-dom`.\n\nIf you're interested to know how `react-router-dom` is implemented, this repo will help you to understand how it actually works.\n\n#### Syntax\n\n```jsx\n//Define Routes\nimport { BrowserRouter, Route, Redirect } from './lib/my-react-router';\n\n\u003cBrowserRouter\u003e\n  \u003cRedirect path=\"/\" to=\"/login\" /\u003e\n  \u003cRoute path=\"/login\" component={Login} /\u003e\n  \u003cRoute path=\"/home\" component={App} /\u003e\n  \u003cRoute path=\"/contact\" component={Contact} /\u003e\n\u003c/BrowserRouter\u003e;\n```\n\n```jsx\n//Inside Component. `Link` and `props.history`\nimport { Link } from './lib/my-react-router';\n\nfunction Home(props) {\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e props.history.push('/login')}\u003e\n        Login Page via click\n      \u003c/button\u003e\n      \u003cLink to={'/login'}\u003eLogin page vai link\u003c/Link\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n#### Code\n\n[src/lib/my-react-route.js](src/lib/my-react-router.js) _(less than 100 lines)_\n\n\u003cbr\u003e\n\n\u003e Note: This sample project does not handle all edge cases and of course it's not as comprehensive as `react-router-dom`. I always wonder how react-router actually works, that is why I was trying out how I can implement it. That's all about the repo.\n\n\u003cbr\u003e\n\n`:wq!`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritwickdey%2Fmy-react-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fritwickdey%2Fmy-react-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritwickdey%2Fmy-react-router/lists"}