{"id":13429577,"url":"https://github.com/yesmeck/react-with-hooks","last_synced_at":"2025-05-12T14:50:43.966Z","repository":{"id":57347767,"uuid":"154931607","full_name":"yesmeck/react-with-hooks","owner":"yesmeck","description":"[OUTDATED]Ponyfill for the React Hooks API (Support RN)","archived":false,"fork":false,"pushed_at":"2019-02-15T09:19:41.000Z","size":123,"stargazers_count":152,"open_issues_count":2,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-26T18:48:28.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/olx6zp44n6","language":"JavaScript","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/yesmeck.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":"2018-10-27T06:00:30.000Z","updated_at":"2024-09-19T18:05:31.000Z","dependencies_parsed_at":"2022-08-28T04:00:53.686Z","dependency_job_id":null,"html_url":"https://github.com/yesmeck/react-with-hooks","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/yesmeck%2Freact-with-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yesmeck%2Freact-with-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yesmeck%2Freact-with-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yesmeck%2Freact-with-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yesmeck","download_url":"https://codeload.github.com/yesmeck/react-with-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253758705,"owners_count":21959646,"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-07-31T02:00:41.999Z","updated_at":"2025-05-12T14:50:43.901Z","avatar_url":"https://github.com/yesmeck.png","language":"JavaScript","funding_links":[],"categories":["Packages","Extensions/Libraries"],"sub_categories":[],"readme":"# react-with-hooks\n\n[![Build Status](https://img.shields.io/travis/yesmeck/react-with-hooks.svg?style=flat-square)](https://travis-ci.org/yesmeck/react-with-hooks)\n![codecov](https://img.shields.io/codecov/c/github/yesmeck/react-with-hooks.svg?style=flat-square)\n\nPolyfill and ponyfill for the [React Hooks API](https://reactjs.org/docs/hooks-intro.html).\n\nWorks on React Native!\n\n⚠️The code on master branch is still WIP.\n\n## Install\n\n```bash\n$ npm i react-with-hooks --save\n```\n\n## Usage\n\nYou can use `react-with-hooks` as a polyfill; in this case, when you later transition to native React Hooks you will only need to remove the `import 'react-with-hooks/polyfill'` statement:\n\n```javascript\nimport 'react-with-hooks/polyfill'; // import the polyfill in the entry of your application\nimport React, { useState, useEffect } from 'react';\n\nconst Counter = () =\u003e {\n  const [ count, setCount ] = useState(0);\n  useEffect(() =\u003e {\n    document.title = \"count is \" + count;\n  })\n  return (\n    \u003cdiv\u003e\n      {count}\n      \u003cbutton onClick={() =\u003e setCount(count + 1)}\u003e+\u003c/button\u003e\n      \u003cbutton onClick={() =\u003e setCount(count - 1)}\u003e-\u003c/button\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\nAlternatively, you can use this library as a ponyfill with the `withHooks` helper. In this case, you will have to refactor your code later when you transition to use native React Hooks.\n\n```javascript\nimport React from 'react';\nimport withHooks, { useState, useEffect } from 'react-with-hooks';\n\nconst Counter = withHooks(() =\u003e {\n  const [ count, setCount ] = useState(0);\n  useEffect(() =\u003e {\n    document.title = \"count is \" + count;\n  })\n  return (\n    \u003cdiv\u003e\n      {count}\n      \u003cbutton onClick={() =\u003e setCount(count + 1)}\u003e+\u003c/button\u003e\n      \u003cbutton onClick={() =\u003e setCount(count - 1)}\u003e-\u003c/button\u003e\n    \u003c/div\u003e\n  );\n});\n```\n\n[Live Demo](https://codesandbox.io/s/olx6zp44n6)\n\n## API Reference\n\n- Basic Hooks\n  - [useState](https://reactjs.org/docs/hooks-reference.html#usestate)\n  - [useEffect](https://reactjs.org/docs/hooks-reference.html#useeffect)\n  - [useContext](https://reactjs.org/docs/hooks-reference.html#usecontext)\n- Additional Hooks\n  - [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer)\n  - [useCallback](https://reactjs.org/docs/hooks-reference.html#usecallback)\n  - [useMemo](https://reactjs.org/docs/hooks-reference.html#usememo)\n  - [useRef](https://reactjs.org/docs/hooks-reference.html#useref)\n  - [useImperativeHandle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle)\n  - [useLayoutEffect](https://reactjs.org/docs/hooks-reference.html#uselayouteffect)\n\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyesmeck%2Freact-with-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyesmeck%2Freact-with-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyesmeck%2Freact-with-hooks/lists"}