{"id":13680170,"url":"https://github.com/tannerlinsley/use-react-hooks","last_synced_at":"2025-04-14T13:11:25.127Z","repository":{"id":57387961,"uuid":"156433031","full_name":"tannerlinsley/use-react-hooks","owner":"tannerlinsley","description":"Use hooks in classes in React 16.5+","archived":false,"fork":false,"pushed_at":"2018-11-23T19:56:04.000Z","size":160,"stargazers_count":82,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T01:36:08.848Z","etag":null,"topics":["hooks","javascript","react","react-hooks"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/wor3rxopv8","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/tannerlinsley.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-11-06T19:00:52.000Z","updated_at":"2025-02-18T10:41:34.000Z","dependencies_parsed_at":"2022-09-05T05:00:28.750Z","dependency_job_id":null,"html_url":"https://github.com/tannerlinsley/use-react-hooks","commit_stats":null,"previous_names":["tannerlinsley/use-class-hooks"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tannerlinsley%2Fuse-react-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tannerlinsley%2Fuse-react-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tannerlinsley%2Fuse-react-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tannerlinsley%2Fuse-react-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tannerlinsley","download_url":"https://codeload.github.com/tannerlinsley/use-react-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650508,"owners_count":21139678,"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":["hooks","javascript","react","react-hooks"],"created_at":"2024-08-02T13:01:13.841Z","updated_at":"2025-04-14T13:11:24.675Z","avatar_url":"https://github.com/tannerlinsley.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# use-react-hooks\n\n`use-react-hooks` adds support for hooks in React v16.6!\n\n- ✂️ Tiny (3kb and 200 LOC)\n- ⛑ Safely reverse-engineered using class lifecycles\n- 🛠 Provides a clean and clear upgrade path to 16.7 when ready.\n\n## Demos\n\n- [Codesandbox Example](https://codesandbox.io/s/wor3rxopv8)\n- [Intro Video](https://www.youtube.com/watch?v=aYOVH7VY0Jc)\n\n## Install\n\n```bash\nnpm install --save use-react-hooks\n# or\nyarn add use-react-hooks\n```\n\n## Usage\n\nTo use hooks in a functional compoennt, wrap it in `useHooks` then use any hook you want!\n\n```jsx\nimport React from \"react\";\nimport { useHooks, useState } from \"use-react-hooks\";\n\nconst App = useHooks(props =\u003e {\n  const [count, setCount] = useState(0);\n  return (\n    \u003cdiv\u003e\n      Count: {count}\n      \u003cbutton onClick={() =\u003e setCount(old =\u003e old + 1)}\u003eIncrement\u003c/button\u003e\n    \u003c/div\u003e\n  );\n});\n```\n\n## Documentation\n\nThe following hooks are available as named exports from the `use-react-hooks` package and follow the official React Hooks API here: https://reactjs.org/docs/hooks-reference.html\n\n- `useReducer`\n- `useState`\n- `useContext`\n- `useMemo`\n- `useCallback`\n- `useEffect`\n- `useRef`\n- `useImperativeMethods`\n- `useMutationEffect` _Note: currently identical to `useEffect`_\n- `useLayoutEffect` _Note: currently identical to `useEffect`_\n\n## Additional Hooks\n\nThe following hooks are also provided for convenience:\n\n- `usePrevious` - Returns the previously rendered value you pass it\n\n## License\n\nMIT © [tannerlinsley](https://github.com/tannerlinsley)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftannerlinsley%2Fuse-react-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftannerlinsley%2Fuse-react-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftannerlinsley%2Fuse-react-hooks/lists"}