{"id":20350015,"url":"https://github.com/webbestmaster/react-router-dom-hook","last_synced_at":"2025-03-04T16:26:46.603Z","repository":{"id":57343760,"uuid":"392733567","full_name":"webbestmaster/react-router-dom-hook","owner":"webbestmaster","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-31T20:40:30.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T23:46:21.523Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/webbestmaster.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":"2021-08-04T15:10:49.000Z","updated_at":"2021-11-08T19:55:34.000Z","dependencies_parsed_at":"2022-09-12T06:30:24.745Z","dependency_job_id":null,"html_url":"https://github.com/webbestmaster/react-router-dom-hook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webbestmaster%2Freact-router-dom-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webbestmaster%2Freact-router-dom-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webbestmaster%2Freact-router-dom-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webbestmaster%2Freact-router-dom-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webbestmaster","download_url":"https://codeload.github.com/webbestmaster/react-router-dom-hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241879302,"owners_count":20035755,"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":[],"created_at":"2024-11-14T22:28:33.785Z","updated_at":"2025-03-04T16:26:46.581Z","avatar_url":"https://github.com/webbestmaster.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Router Dom Hook\n\n[![GitHub license](https://img.shields.io/npm/l/react-router-dom-hook)](https://github.com/webbestmaster/react-router-dom-hook/blob/master/license)\n[![npm version](https://img.shields.io/npm/v/react-router-dom-hook.svg?style=flat)](https://www.npmjs.com/package/react-router-dom-hook)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-router-dom-hook)\n\u003c!-- [![GitHub stars](https://img.shields.io/github/stars/webbestmaster/react-router-dom-hook?style=social\u0026maxAge=2592000)](https://github.com/webbestmaster/react-router-dom-hook/) --\u003e\n\nHook to work with react-router-dom@5.x. Helpful component (NavigationLink) included!\n\nDeprecated. Use react-router-dom@6+, it already includes all needed hooks.\n\n## Install\n\n```bash\nnpm i react-router-dom-hook\n```\n\n## Usage\n```typescript jsx\nimport {BrowserRouter, Route, Switch} from 'react-router-dom';\nimport {useUrl, NavigationLink} from 'react-router-dom-hook';\n\nexport function ExampleComponent(): JSX.Element {\n    // WARNINGS:\n    // 1 - react-router-dom is required\n    // 2 - use inside BrowserRouter -\u003e Switch only\n\n    const {\n        pathname, // string, current path name\n        pushState, // (newPathname: string, queryMap: Partial\u003cQueryMap\u003e, options?: UseUrlHookOptionsType) =\u003e void\n        pushPathname, // (newPathname: string, options?: UseUrlHookOptionsType) =\u003e void\n        replaceState, // (newPathname: string, queryMap: Partial\u003cQueryMap\u003e, options?: UseUrlHookOptionsType) =\u003e void\n        replacePathname, // (newPathname: string, options?: UseUrlHookOptionsType) =\u003e void\n        queries, // current query map\n        setQuery, // (queryMap: Partial\u003cQueryMap\u003e, options?: UseUrlHookOptionsType) =\u003e void\n        getQuery, // (key: keyof QueryMap) =\u003e string | null\n        deleteQuery, // (key: keyof QueryMap) =\u003e void\n    } = useUrl\u003c{queryMapKey: string}\u003e(); // generic is optional, default is ObjectToUrlParametersType\n\n    return (\n        \u003cNavigationLink\n            isSaveQueries={false} // boolean, optional, default is true, save or remove existed query\n            queries={{newQuery: 'it-is-me!'}} // ObjectToUrlParametersType, optional, default is {}, new query map, existed query will be replaced\n            to=\"new/path\" // string, required, new pathname\n        \u003e\n            to other page\n        \u003c/NavigationLink\u003e\n    );\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebbestmaster%2Freact-router-dom-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebbestmaster%2Freact-router-dom-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebbestmaster%2Freact-router-dom-hook/lists"}