{"id":22891585,"url":"https://github.com/hanford/react-commit","last_synced_at":"2026-04-10T16:44:48.920Z","repository":{"id":66328693,"uuid":"147735674","full_name":"hanford/react-commit","owner":"hanford","description":"lazily execute async functions on user initiated action","archived":false,"fork":false,"pushed_at":"2018-09-06T21:34:41.000Z","size":71,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:05:30.972Z","etag":null,"topics":["async","commit","graphql","lazy","react","render-function"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hanford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"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":"2018-09-06T21:27:41.000Z","updated_at":"2024-04-25T09:03:43.000Z","dependencies_parsed_at":"2023-02-21T02:31:32.982Z","dependency_job_id":null,"html_url":"https://github.com/hanford/react-commit","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/hanford%2Freact-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanford","download_url":"https://codeload.github.com/hanford/react-commit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246540523,"owners_count":20793930,"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":["async","commit","graphql","lazy","react","render-function"],"created_at":"2024-12-13T22:34:34.325Z","updated_at":"2026-04-10T16:44:48.864Z","avatar_url":"https://github.com/hanford.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-commit\n\u003e lazily execute async functions on user initiated action\n\n[![npm package][npm-badge]][npm]\n\n### Usage\n\n```sh\n$ npm install react-commit --save\n```\n\n```js\nimport Commit from 'react-commit'\n\n...\nreturn (\n  \u003cCommit\n    fn={RequestTempToken.commit}\n    onMouseEnter\n    delayMs={500}\n    cacheTime={60 * 1000}\n  \u003e\n    {({ isLoading, retry, err, res }) =\u003e (\n      \u003cButton\n        onClick={() =\u003e (err || !res ? retry() : this.onClick(res))}\n        disabled={disabled ? disabled : isLoading}\n      \u003e\n        {children}\n      \u003c/Button\u003e\n    )}\n  \u003c/Commit\u003e\n)\n```\n\n## API\n| Param          | Type    | functionality | required |\n|----------------|---------|-----------------|-----------------|\n| fn           | Function | function to execute | true |\n| children       | Function    | receive {isLoading, retry, err, res} | true |\n| delayMs       | miliseconds    | minimum time to be isLoading = true | false |\n| cacheTime       | miliseconds    | time to cache res before invoking fn again | false |\n| onMouseEnter       | Boolean    | whether to invoke fn on mouseEnter | false |\n| onClick       | Boolean    | whether to invoke fn on onClick | false |\n\n\n[npm-badge]: https://img.shields.io/npm/v/react-commit.png?style=flat-square\n[npm]: https://www.npmjs.org/package/react-commit\n\nQuestions? Feedback? [Please let me know](https://github.com/hanford/react-commit/issues/new)\n\n## License (MIT)\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\nCopyright © 2017-present [Jack Hanford](http://jackhanford.com) jackhanford@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Freact-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanford%2Freact-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Freact-commit/lists"}