{"id":13481492,"url":"https://github.com/axross/repromised","last_synced_at":"2025-07-10T06:31:25.236Z","repository":{"id":57353917,"uuid":"143054616","full_name":"axross/repromised","owner":"axross","description":"🤝 Declarative promise resolver as a render props component","archived":false,"fork":false,"pushed_at":"2019-02-20T07:07:42.000Z","size":176,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T16:06:24.496Z","etag":null,"topics":["promise","react","react-native","render-props","typescript"],"latest_commit_sha":null,"homepage":"","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/axross.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-07-31T18:51:51.000Z","updated_at":"2021-03-31T19:40:19.000Z","dependencies_parsed_at":"2022-09-05T11:20:29.809Z","dependency_job_id":null,"html_url":"https://github.com/axross/repromised","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/axross/repromised","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axross%2Frepromised","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axross%2Frepromised/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axross%2Frepromised/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axross%2Frepromised/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axross","download_url":"https://codeload.github.com/axross/repromised/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axross%2Frepromised/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264538581,"owners_count":23624436,"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":["promise","react","react-native","render-props","typescript"],"created_at":"2024-07-31T17:00:52.279Z","updated_at":"2025-07-10T06:31:24.979Z","avatar_url":"https://github.com/axross.png","language":"TypeScript","readme":"# [![Repromised](https://user-images.githubusercontent.com/4289883/43491551-dc28c168-94d9-11e8-8c56-b10389544933.png)](https://github.com/axross/repromised)\n\n[![npm](https://img.shields.io/npm/dt/repromised.svg)](https://www.npmjs.com/package/repromised)\n[![GitHub stars](https://img.shields.io/github/stars/axross/repromised.svg)](https://github.com/axross/repromised/stargazers)\n[![GitHub license](https://img.shields.io/github/license/axross/repromised.svg)](https://github.com/axross/repromised/blob/master/LICENSE)\n\n**Repromised** is a component to build children by resolving a promise with\n[Render Props](https://reactjs.org/docs/render-props.html) pattern.\n\n- 🚀 Dependency free\n- 🏄‍ Extremely tiny\n- 🔌 Plug and Play\n- 👷 Well tested\n- 👔 Built with TypeScript\n\n## Example\n\n[**TRY IT OUT HERE**](https://codesandbox.io/s/0mkr4nkokv)\n\n[\u003cimg src=\"https://user-images.githubusercontent.com/4289883/43618182-cc1e7e0e-967b-11e8-892f-3aecfaf8ece6.gif\" alt=\"Repromised Example\" width=\"480\" /\u003e](https://codesandbox.io/s/0mkr4nkokv)\n\n## Install\n\n```\nnpm i -S repromised\n```\n\n## APIs\n\n### `\u003cRepromised\u003e`\n\n#### Props\n\n| Name       | Type                                                                    | Required | Description                                                                      |\n| ---------- | ----------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------- |\n| `promise`  | `() =\u003e Promise\u003cValue\u003e`                                                  | ✓        | A function returning a promise (it will be called when the component is mounted) |\n| `initial`  | `Value` (the same type with the value what the promise should resolves) |          | An initial value                                                                 |\n| `children` | `(snapshot: Snapshot) =\u003e ReactNode`                                     |          | A render props function                                                          |\n\n#### Snapshot\n\n`\u003cRepromised\u003e` receives children as a render-props pattern function that gives a snapshot object which has the shape like the following:\n\n| Name           | Type                                                    | Description                                                                                                                        |\n| -------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| `status`       | `\"PENDING\"`, `\"FULFILLED\"` or `\"REJECTED\"`              | The promise's status. In TypeScript you can use `Status` enum instead of string enum                                               |\n| `value`        | `Value` (the value what the promise resolves) or `null` | The value what the promise resolves. When `status` is `\"PENDING\"` or `\"REJECTED\"` and `props.initial` is not given, this is `null` |\n| `error`        | `Error` or `null`                                       | The error when the promise rejects. This is `null` if `status` is not `\"REJECTED\"`                                                 |\n| `isLoading`    | `boolean`                                               | A short hand value whether the promise's status is `\"PENDING\"` or not (same with to `status === \"PENDING\"`).                       |\n| `requireValue` | `Value` (the value what the promise resolves)           | Same as `value` but it throws an error if `value` is `null`                                                                        |\n\n#### Usage\n\n\u003c!-- prettier-ignore --\u003e\n```jsx\nimport Repromised from 'repromised';\n\nconst SearchResult = ({ query }) =\u003e (\n  \u003cRepromised promise={() =\u003e fetchByQuery(query)} initial={[]} key={query}\u003e\n    {snapshot =\u003e snapshot.isLoading\n      ? \u003cLoading /\u003e\n      : \u003cResultList\u003e\n          {snapshot.value.map(result =\u003e \u003cResultListItem result={result} /\u003e)}\n        \u003c/ResultList\u003e\n    }\n  \u003c/Repromised\u003e\n);\n```\n\n## License\n\nMIT\n\n## Contribute\n\nAny feedback is welcome! You can help improving this project leaving Pull requests and helping with Issues.\n","funding_links":[],"categories":["Components"],"sub_categories":["Data"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxross%2Frepromised","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxross%2Frepromised","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxross%2Frepromised/lists"}