{"id":15861653,"url":"https://github.com/leroyanders/react-hooks","last_synced_at":"2026-05-01T15:31:23.444Z","repository":{"id":53825652,"uuid":"521604776","full_name":"leroyanders/react-hooks","owner":"leroyanders","description":"Most useful custom React.js hooks with examples.","archived":false,"fork":false,"pushed_at":"2022-08-06T07:54:05.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T20:34:07.627Z","etag":null,"topics":["es6","hooks","javascript","react","react-hooks","reactjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/leroyanders.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}},"created_at":"2022-08-05T11:00:31.000Z","updated_at":"2025-03-17T14:22:12.000Z","dependencies_parsed_at":"2022-08-21T15:00:48.560Z","dependency_job_id":null,"html_url":"https://github.com/leroyanders/react-hooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leroyanders/react-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leroyanders%2Freact-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leroyanders%2Freact-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leroyanders%2Freact-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leroyanders%2Freact-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leroyanders","download_url":"https://codeload.github.com/leroyanders/react-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leroyanders%2Freact-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32502935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["es6","hooks","javascript","react","react-hooks","reactjs"],"created_at":"2024-10-05T22:03:40.998Z","updated_at":"2026-05-01T15:31:23.427Z","avatar_url":"https://github.com/leroyanders.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React's most useful hooks\n\n+ [Hooks](#hooks)\n  - [useArray](#usearray)\n  - [useBrowserHistory](#usebrowserhistory)\n  - [useClientOnline](#useclientonline)\n  - [useClipboard](#useclipboard)\n  - [useCookieStorage](#usecookiestorage)\n  - [useEventListener](#useeventlistener)\n  - [usePrevious](#useprevious)\n  - [useRenderCount](#userendercount)\n  - [useLocalStorage](#uselocalstorage)\n  - [useSessionStorage](#usesessionstorage)\n  - [useToggle](#usetoggle)\n\n\u003cdiv id=\"hook\"\u003e\n\n# useArray\n\n```javascript\nconst [array, setArray] = useArray(defaultValue)\n```\n\n\n# useBrowserHistory\n\n```javascript\nconst [handleBack, handleForward] = useBrowserHistory(name, isActive, onBack, onForward);\n```\n\n# useClientOnline\n\n```javascript\nconst online = useOnlineStatus() // boolean (true, false)\n```\n\n# useClipboard\n\n```javascript\nconst [copyToClipboard, { success }] = useCopyToClipboard()\n```\n\nHow to use:\n```javascript\n\u003cbutton onClick={() =\u003e copyToClipboard(\"This was copied\")}\u003e\n  {success ? \"Copied\" : \"Copy Text\"}\n\u003c/button\u003e\n```\n\n# useCookieStorage\n\n```javascript\nconst [cookie, setCookie] = useCookie();\n```\n\n# useEventListener\n\n```javascript\nuseEventListener(\"clieck\", e =\u003e {\n    console.log(e.target)\n})\n```\n\n# usePrevious\n\n```javascript\nconst previousValue = usePrevious(value)\n```\n\n\n# useRenderCount\n\n```javascript\nconst count = useRenderCount() // integer\n```\n\n# useLocalStorage\n\n```javascript\nconst [name, setName] = useLocalStorage()\n```\n\n# useSessionStorage\n\n```javascript\nconst [name, setName] = useSessionStorage()\n```\n\n# useToggle\n\n```javascript\nconst [value, toggleValue] = useToggle(false)\n```\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleroyanders%2Freact-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleroyanders%2Freact-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleroyanders%2Freact-hooks/lists"}