{"id":13393701,"url":"https://github.com/facebookexperimental/Recoil","last_synced_at":"2025-03-13T19:31:45.269Z","repository":{"id":37077703,"uuid":"261279710","full_name":"facebookexperimental/Recoil","owner":"facebookexperimental","description":"Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.","archived":true,"fork":false,"pushed_at":"2025-01-01T08:07:34.000Z","size":49827,"stargazers_count":19628,"open_issues_count":324,"forks_count":1219,"subscribers_count":195,"default_branch":"main","last_synced_at":"2025-03-13T00:54:49.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://recoiljs.org/","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/facebookexperimental.png","metadata":{"files":{"readme":"README-recoil-relay.md","changelog":"CHANGELOG-recoil-relay.md","contributing":"CONTRIBUTING.md","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":"2020-05-04T19:44:15.000Z","updated_at":"2025-03-12T18:46:54.000Z","dependencies_parsed_at":"2023-09-22T16:59:04.106Z","dependency_job_id":"e39a20c5-b208-4033-9429-a0c17f3ea5b5","html_url":"https://github.com/facebookexperimental/Recoil","commit_stats":{"total_commits":933,"total_committers":135,"mean_commits":6.911111111111111,"dds":0.570203644158628,"last_synced_commit":"c1b97f3a0117cad76cbc6ab3cb06d89a9ce717af"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookexperimental%2FRecoil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookexperimental%2FRecoil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookexperimental%2FRecoil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookexperimental%2FRecoil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookexperimental","download_url":"https://codeload.github.com/facebookexperimental/Recoil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469194,"owners_count":20295705,"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-30T17:00:58.840Z","updated_at":"2025-03-13T19:31:44.177Z","avatar_url":"https://github.com/facebookexperimental.png","language":"JavaScript","funding_links":[],"categories":["State Management","JavaScript","Uncategorized","Utilities","Please find below the links to awesome cheat-sheet and resources:","Tools","Explanation of each State Management","数据流","**Awesome React** [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)","语言资源库","others","目录","React","⚛️ React","📖 Categories","Frameworks","List","React [🔝](#readme)","📦 Legacy \u0026 Inactive Projects"],"sub_categories":["Uncategorized","State Management","React/React-Native:","Client-State management","Recoil","macros","React","JavaScript","State management","State of the React","\u003ca id=\"state\"\u003e状态管理\u003c/a\u003e"],"readme":"# Recoil Relay \u0026middot; [![NPM Version](https://img.shields.io/npm/v/recoil-relay)](https://www.npmjs.com/package/recoil-relay) [![Node.js CI](https://github.com/facebookexperimental/Recoil/workflows/Node.js%20CI/badge.svg)](https://github.com/facebookexperimental/Recoil/actions) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [![Follow on Twitter](https://img.shields.io/twitter/follow/recoiljs?label=Follow%20Recoil\u0026style=social)](https://twitter.com/recoiljs)\n\nThe `recoil-relay` library helps [Recoil](https://recoiljs.org) perform type safe and efficient queries using [GraphQL](https://graphql.org/) with the [Relay](https://relay.dev) library.\n\nPlease see the [**Recoil Relay GraphQL Documentation**](https://recoiljs.org/docs/recoil-relay/introduction)\n\n`recoil-relay` provides `graphQLSelector()` and `graphQLSelectorFamily()` selectors which can easily query with GraphQL.  The queries are synced with the Recoil data-flow graph so downstream selectors can derive state from them, they can depend on upstream Recoil state, and they are automatically subscribed to any changes in the graph from Relay.  Everything stays in sync automatically.\n\n## Example\nAfter setting up your Relay environment adding a GraphQL query is as simple as defining a [GraphQL selector](https://recoiljs.org/docs/recoil-relay/graphql-selectors).\n\n```jsx\nconst userNameQuery = graphQLSelector({\n  key: 'UserName',\n  environment: myEnvironment,\n  query: graphql`\n    query UserQuery($id: ID!) {\n      user(id: $id) {\n        name\n      }\n    }\n  `,\n  variables: ({get}) =\u003e ({id: get(currentIDAtom)}),\n  mapResponse: data =\u003e data.user?.name,\n});\n```\nThen use it like any other Recoil [selector](https://recoiljs.org/docs/api-reference/core/selector):\n```jsx\nfunction MyComponent() {\n  const userName = useRecoilValue(userNameQuery);\n  return \u003cspan\u003e{userName}\u003c/span\u003e;\n}\n```\n\n## Installation\n\nPlease see the [Recoil installation guide](https://recoiljs.org/docs/introduction/installation) for installing Recoil and the [Relay documentation](https://relay.dev/docs/getting-started/installation-and-setup/) for installing and setting up the Relay library, GraphQL compiler, Babel plugin, and ESLint plugin.  Then add `recoil-relay` as a dependency.\n\n## Contributing\n\nDevelopment of Recoil happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Recoil.\n\n- [Code of Conduct](./CODE_OF_CONDUCT.md)\n- [Contributing Guide](./CONTRIBUTING.md)\n\n### License\n\nRecoil is [MIT licensed](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookexperimental%2FRecoil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookexperimental%2FRecoil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookexperimental%2FRecoil/lists"}