{"id":25923892,"url":"https://github.com/rutu-ja/react-custom-hook","last_synced_at":"2026-04-19T14:06:12.366Z","repository":{"id":275759857,"uuid":"927096440","full_name":"Rutu-ja/react-custom-hook","owner":"Rutu-ja","description":"A collection of useful custom React hooks to simplify state management, UI interactions, and API calls.","archived":false,"fork":false,"pushed_at":"2025-02-20T10:24:12.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T17:18:29.424Z","etag":null,"topics":["custom-hooks-in-react","hooks","npm","react"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/custom-react-hook-collection","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/Rutu-ja.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":"2025-02-04T11:56:54.000Z","updated_at":"2025-02-20T10:24:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b645270-c188-42cd-b8cd-3c465c7bbd89","html_url":"https://github.com/Rutu-ja/react-custom-hook","commit_stats":null,"previous_names":["rutu-ja/react-custom-hook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutu-ja%2Freact-custom-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutu-ja%2Freact-custom-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutu-ja%2Freact-custom-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutu-ja%2Freact-custom-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rutu-ja","download_url":"https://codeload.github.com/Rutu-ja/react-custom-hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241705918,"owners_count":20006399,"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":["custom-hooks-in-react","hooks","npm","react"],"created_at":"2025-03-03T17:18:33.224Z","updated_at":"2026-04-19T14:06:12.340Z","avatar_url":"https://github.com/Rutu-ja.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom React Hooks Collection\n\nA collection of useful custom React hooks to simplify state management, UI interactions, and API calls.\n\n## Installation\n\nYou can install this package using npm or yarn:\n\n```sh\nnpm install custom-react-hooks\n```\n\nor\n\n```sh\nyarn add custom-react-hooks\n```\n\n## Usage\n\nImport the hooks you need into your React components:\n\n```tsx\nimport {\n  useClipboard,\n  useDarkMode,\n  useDebounce,\n  useFetch,\n} from \"custom-react-hooks\";\n```\n\n## Available Hooks\n\n### 1. `useClipboard`\n\nCopy text to clipboard.\n\n```tsx\nconst { copyToClipboard } = useClipboard();\n\u003cbutton onClick={() =\u003e copyToClipboard(\"Copied text!\")}\u003eCopy\u003c/button\u003e;\n```\n\n---\n\n### 2. `useDarkMode`\n\nToggle dark mode state.\n\n```tsx\nconst [isDarkMode, toggleDarkMode] = useDarkMode();\n\u003cbutton onClick={toggleDarkMode}\u003eToggle Dark Mode\u003c/button\u003e;\n```\n\n---\n\n### 3. `useDebounce`\n\nDebounce a value with a delay.\n\n```tsx\nconst debouncedValue = useDebounce(searchTerm, 500);\n```\n\n---\n\n### 4. `useDocumentTitle`\n\nSet the document title dynamically.\n\n```tsx\nuseDocumentTitle(\"My Custom Title\");\n```\n\n---\n\n### 5. `useFetch`\n\nFetch data from an API.\n\n```tsx\nconst { data, loading, error } = useFetch(\n  \"https://jsonplaceholder.typicode.com/users\"\n);\n```\n\n---\n\n### 6. `useGeolocation`\n\nGet the user's current location.\n\n```tsx\nconst { latitude, longitude } = useGeolocation();\n```\n\n---\n\n### 7. `useKeyPress`\n\nDetect when a key is pressed.\n\n```tsx\nconst isEnterPressed = useKeyPress(\"Enter\");\n```\n\n---\n\n### 8. `useLocalStorage`\n\nStore and retrieve values from `localStorage`.\n\n```tsx\nconst [name, setName] = useLocalStorage(\"name\", \"\");\n```\n\n---\n\n### 9. `useMediaQuery`\n\nDetect screen size changes.\n\n```tsx\nconst isMobile = useMediaQuery(\"(max-width: 768px)\");\n```\n\n---\n\n### 10. `useSessionStorage`\n\nStore values in `sessionStorage`.\n\n```tsx\nconst [email, setEmail] = useSessionStorage(\"email\", \"\");\n```\n\n---\n\n### 11. `useTimeout`\n\nExecute a function after a delay.\n\n```tsx\nconst { start, clear } = useTimeout(() =\u003e console.log(\"Timeout!\"), 5000);\n```\n\n---\n\n### 12. `useToggle`\n\nToggle a boolean state.\n\n```tsx\nconst [isOpen, toggle] = useToggle();\n```\n\n---\n\n### 13. `useWindowSize`\n\nGet window width and height.\n\n```tsx\nconst { width, height } = useWindowSize();\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Feel free to open an issue or submit a pull request.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frutu-ja%2Freact-custom-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frutu-ja%2Freact-custom-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frutu-ja%2Freact-custom-hook/lists"}