{"id":16827862,"url":"https://github.com/awmleer/reto","last_synced_at":"2025-08-09T19:21:27.020Z","repository":{"id":34867174,"uuid":"185387820","full_name":"awmleer/reto","owner":"awmleer","description":"Flexible and efficient React Store with hooks.","archived":false,"fork":false,"pushed_at":"2023-03-04T03:42:18.000Z","size":887,"stargazers_count":215,"open_issues_count":8,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T10:08:35.296Z","etag":null,"topics":["dependency-injection","hooks","react","reactjs","redux","state-management","store"],"latest_commit_sha":null,"homepage":"https://reto.js.org","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/awmleer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-07T11:29:09.000Z","updated_at":"2025-03-10T03:09:54.000Z","dependencies_parsed_at":"2024-06-21T05:43:10.773Z","dependency_job_id":"4e7ac92f-a095-471f-8d8c-b0bfd7fe4370","html_url":"https://github.com/awmleer/reto","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awmleer%2Freto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awmleer%2Freto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awmleer%2Freto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awmleer%2Freto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awmleer","download_url":"https://codeload.github.com/awmleer/reto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246457967,"owners_count":20780676,"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":["dependency-injection","hooks","react","reactjs","redux","state-management","store"],"created_at":"2024-10-13T11:23:13.844Z","updated_at":"2025-03-31T11:01:35.910Z","avatar_url":"https://github.com/awmleer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reto\n\n[![GitHub](https://img.shields.io/github/license/awmleer/reto.svg?logo=github)](https://github.com/awmleer/reto)\n[![codecov](https://img.shields.io/codecov/c/github/awmleer/reto/master?logo=codecov)](https://codecov.io/gh/awmleer/reto)\n[![npm version](https://img.shields.io/npm/v/reto.svg?logo=npm)](https://www.npmjs.com/package/reto)\n[![npm downloads](https://img.shields.io/npm/dw/reto.svg?logo=npm)](https://www.npmjs.com/package/reto)\n[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/reto.svg?logo=javascript)](https://www.npmjs.com/package/reto)\n[![Build Status](https://img.shields.io/travis/awmleer/reto/master?logo=travis-ci)](https://travis-ci.org/awmleer/reto)\n[![codacy](https://img.shields.io/codacy/grade/2d15789ec7b1424092ed472f449a0a70?logo=codacy)](https://app.codacy.com/app/awmleer/reto)\n[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/reto?logo=snyk)](https://app.snyk.io/test/github/awmleer/reto?targetFile=package.json)\n![React](https://img.shields.io/npm/dependency-version/reto/peer/react?logo=react)\n\n```\n             ___                  __ \n            / _ \\___    ___ _____/ /_\n           / , _/ -_)  / _ `/ __/ __/\n   ____   /_/|_|\\__/   \\_,_/\\__/\\__/ \n  / __/  / /____     _______         \n _\\ \\   / __/ _ \\   / __/ -_)        \n/___/   \\__/\\___/  /_/  \\__/         \n                                     \n```\n\nFlexible and efficient React Store with hooks.\n\n## Features\n\n- Supports all react hooks. Writing a store is just like writing a component.\n- Simple but efficient, quite easy to learn.\n- Use multiple stores to organize your data.\n- Dependency injection based on React Context.\n- Strongly typed with Typescript, also works well with JS.\n\n## Docs\n\n[English](https://reto.js.org/#/) | [中文](https://reto.js.org/#/zh-cn/)\n\n## Install\n\n```bash\n$ yarn add reto\n# or\n$ npm install reto --save\n```\n\n## Try It Online\n\n[![Edit react](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/awmleer/reto-demo/tree/master/?fontsize=14)\n\n## A Simple Example\n\nEvery `Store` is a function similar to a custom hook. In the body of a `Store` function, you can use any react hooks, for example, `useState`, `useEffect`, `useRef`.\n\n```jsx\nexport function FooStore() {\n  const [x, setX] = useState(initial)\n  return {\n    x,\n    setX\n  }\n}\n```\n\nThen, you can provide a store \"instance\" using `Provider` component.\n\n```jsx\nimport {Provider} from 'reto'\n\n\u003cProvider of={FooStore}\u003e\n  \u003cApp/\u003e\n\u003c/Provider\u003e\n```\n\nBy using the `useStore` hook, you can retrieve the store \"instance\" in components, and subscribe to its changes. \n\n```jsx\nimport {useStore} from 'reto'\n\nconst App: FC = (props) =\u003e {\n  const fooStore = useStore(FooStore)\n  \n  function changeStore() {\n    fooStore.setX(fooStore.x + 1)\n  }\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={changeStore}\u003eChange\u003c/button\u003e\n      {fooStore.x}\n    \u003c/div\u003e\n  )\n}\n```\n\nSo when you click the \"Change\" button, the `setX` function of `fooStore` is executed, thereby triggers the update of state `x` and the rerender of `App` component. Everything is simple and straightforward.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawmleer%2Freto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawmleer%2Freto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawmleer%2Freto/lists"}