{"id":20022220,"url":"https://github.com/lucifier129/react-use-setup","last_synced_at":"2025-10-25T22:13:21.261Z","repository":{"id":57347202,"uuid":"203291006","full_name":"Lucifier129/react-use-setup","owner":"Lucifier129","description":"Implement the mechanism of Vue 3.0 Composition API for React based on React Hooks","archived":false,"fork":false,"pushed_at":"2019-08-26T08:39:13.000Z","size":13,"stargazers_count":30,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T18:40:59.540Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Lucifier129.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":"2019-08-20T03:15:01.000Z","updated_at":"2023-08-31T06:24:37.000Z","dependencies_parsed_at":"2022-09-18T17:51:54.201Z","dependency_job_id":null,"html_url":"https://github.com/Lucifier129/react-use-setup","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/Lucifier129%2Freact-use-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Freact-use-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Freact-use-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Freact-use-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lucifier129","download_url":"https://codeload.github.com/Lucifier129/react-use-setup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252423123,"owners_count":21745547,"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-11-13T08:39:36.453Z","updated_at":"2025-10-25T22:13:21.163Z","avatar_url":"https://github.com/Lucifier129.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to react-use-setup 👋\n\n[![npm version](https://img.shields.io/npm/v/react-use-setup.svg?style=flat)](https://www.npmjs.com/package/react-use-setup)\n[![Build Status](https://travis-ci.org/Lucifier129/react-use-setup.svg?branch=master)](https://travis-ci.org/Lucifier129/react-use-setup)\n[![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://github.com/Lucifier129/react-use-setup#readme)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/Lucifier129/react-use-setup/graphs/commit-activity)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Lucifier129/react-use-setup/blob/master/LICENSE)\n[![Twitter: guyingjie129](https://img.shields.io/twitter/follow/guyingjie129.svg?style=social)](https://twitter.com/guyingjie129)\n\n\u003e Implement the mechanism of Vue 3.0 Composition API for React based on React Hooks\n\n### 🏠 [Homepage](https://github.com/Lucifier129/react-use-setup#readme)\n\n## Features\n\nTODO\n\n## Environment Requirement\n\n- ES2015 Proxy\n- ES0215 Map\n- ES2015 Symbol\n\n[Can I Use Proxy?](https://caniuse.com/#search=Proxy)\n\n## Install\n\n```sh\nnpm install --save react-use-setup\n```\n\n```sh\nyarn add react-use-setup\n```\n\n## Usage\n\n- Counter Examples\n\n```javascript\nimport React from 'react'\nimport { reactive, useSetup } from 'react-use-setup'\n\nlet setupCounter = (initialValue = 0) =\u003e {\n  /**\n   * setup function is the mutable world\n   */\n  let count = reactive({ value: initialValue })\n  let incre = () =\u003e (count.value += 1)\n  let decre = () =\u003e (count.value -= 1)\n\n  // expose the reactive state and update functions\n  return {\n    count,\n    incre,\n    decre\n  }\n}\n\nlet Counter = props =\u003e {\n  // react component is the immutable world\n  // every time the reactive state is mutated\n  // it will emit an immutable state for react component to comsume\n  let { count, incre, decre } = useSetup(() =\u003e setupCounter(props.count))\n\n  return (\n    \u003cbutton onClick={incre} onDoubleClick={decre}\u003e\n      {count.value}\n    \u003c/button\u003e\n  )\n}\n```\n\n## Author\n\n👤 **Jade Gu**\n\n- Twitter: [@guyingjie129](https://twitter.com/guyingjie129)\n- Github: [@Lucifier129](https://github.com/Lucifier129)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\n\nFeel free to check [issues page](https://github.com/Lucifier129/react-use-setup/issues).\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## 📝 License\n\nCopyright © 2019 [Jade Gu](https://github.com/Lucifier129).\n\nThis project is [MIT](https://github.com/Lucifier129/react-use-setup/blob/master/LICENSE) licensed.\n\n---\n\n_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucifier129%2Freact-use-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucifier129%2Freact-use-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucifier129%2Freact-use-setup/lists"}