{"id":43128642,"url":"https://github.com/500tech/hook-cook-book","last_synced_at":"2026-01-31T20:52:46.569Z","repository":{"id":48140315,"uuid":"168674022","full_name":"500tech/hook-cook-book","owner":"500tech","description":"A collection of simple solution to complex problems using React Hooks","archived":false,"fork":false,"pushed_at":"2019-11-13T13:12:13.000Z","size":12,"stargazers_count":30,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-30T10:33:30.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/500tech.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":"2019-02-01T09:31:11.000Z","updated_at":"2024-03-05T21:49:57.000Z","dependencies_parsed_at":"2022-08-22T22:01:07.758Z","dependency_job_id":null,"html_url":"https://github.com/500tech/hook-cook-book","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/500tech/hook-cook-book","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhook-cook-book","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhook-cook-book/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhook-cook-book/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhook-cook-book/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/500tech","download_url":"https://codeload.github.com/500tech/hook-cook-book/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhook-cook-book/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28954406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2026-01-31T20:52:46.439Z","updated_at":"2026-01-31T20:52:46.556Z","avatar_url":"https://github.com/500tech.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Hook Cook Book\n\nSimple Patterns: \n- [useState with init function](https://codesandbox.io/s/92r9yrmnyo)\n- [setState with function](https://codesandbox.io/s/w6xynq3z9l)\n- [Toggle reusable custom hook](https://codesandbox.io/s/zrjn39qqwx)\n- [Computed values with useMemo](https://codesandbox.io/s/v80068jq40)\n\nAdvanced Patterns: \n- [Resource fetching](https://codesandbox.io/s/9z4l2po0pw)\n- [Easier controlled components](https://codesandbox.io/s/o97l3qzq5z)\n- [Throttling with useCallback and useRef](https://codesandbox.io/s/qq8rl8lx96)\n- [Custom hook for objects using lodash](https://codesandbox.io/s/v618v21x5y)\n- [useReducer with action creators](https://codesandbox.io/s/rrryqpwovq)\n- [useState complex object with actions](https://codesandbox.io/s/61qw22lp3z)\n- [Making setInterval declarative (Dan Abramov)](https://codesandbox.io/s/105x531vkq)\n- [Composing setters](https://codesandbox.io/s/composing-state-setters-g6kmq)\n\nComplex UI problems:\n- [Virtual scroll](https://codesandbox.io/s/214p1911yn)\n- [Drag and Drop](https://codesandbox.io/s/v3x74022j5)\n- [Scroll tracking with a reusable custom hook](https://codesandbox.io/s/r5r7w0697q)\n\nPitfalls:\n- [Stale state with useCallback](https://codesandbox.io/s/p55wln789x)\n\nUnder the hood:\n- [Order of effects, layout effects, and renders](https://codesandbox.io/s/rj6m9w531p)\n\n\u003chr/\u003e\n\n### Contribute\n\nSubmit a PR to contribute more examples. Please follow the same format\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500tech%2Fhook-cook-book","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F500tech%2Fhook-cook-book","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500tech%2Fhook-cook-book/lists"}