{"id":14384685,"url":"https://github.com/ajoslin/react-form-lifecycle","last_synced_at":"2025-10-11T14:35:34.626Z","repository":{"id":57159080,"uuid":"129000458","full_name":"ajoslin/react-form-lifecycle","owner":"ajoslin","description":" Effortless forms, no payload. Render-prop wrapper for npm.im/form-lifecycle","archived":false,"fork":false,"pushed_at":"2018-09-07T00:23:19.000Z","size":20,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-21T21:39:09.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ajoslin.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-04-10T22:07:04.000Z","updated_at":"2023-08-18T21:55:51.000Z","dependencies_parsed_at":"2022-09-08T10:40:07.856Z","dependency_job_id":null,"html_url":"https://github.com/ajoslin/react-form-lifecycle","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ajoslin/react-form-lifecycle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajoslin%2Freact-form-lifecycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajoslin%2Freact-form-lifecycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajoslin%2Freact-form-lifecycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajoslin%2Freact-form-lifecycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajoslin","download_url":"https://codeload.github.com/ajoslin/react-form-lifecycle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajoslin%2Freact-form-lifecycle/sbom","scorecard":{"id":174868,"data":{"date":"2025-08-11","repo":{"name":"github.com/ajoslin/react-form-lifecycle","commit":"76138c6795ce53e566de45f215ff5a992a755eb9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T17:27:38.861Z","repository_id":57159080,"created_at":"2025-08-16T17:27:38.862Z","updated_at":"2025-08-16T17:27:38.862Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007448,"owners_count":26084313,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-28T18:01:34.864Z","updated_at":"2025-10-11T14:35:34.608Z","avatar_url":"https://github.com/ajoslin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-form-lifecycle [![Build Status](https://travis-ci.org/ajoslin/react-form-lifecycle.svg?branch=master)](https://travis-ci.org/ajoslin/react-form-lifecycle)\n\n\u003e Effortless forms, no payload. Render-prop wrapper for [FormLifecycle](https://npm.im/form-lifecycle).\n\n\n## Install\n\n```\n$ npm install --save react-form-lifecycle\n```\n\n\n## Usage\n\nRecommended way of doing forms:\n\n```jsx\nvar FormLifecycle = require('react-form-lifecycle')\nvar filterBoolean = require('boolean-filter-obj')\nvar isEmail = require('is-email-maybe')\n\nfunction renderForm () {\n  return \u003cFormLifecycle render={({ form, lifecycle }) =\u003e {\n    var validationErrors = getValidationErrors(form)\n    return \u003cform onSubmit={e =\u003e {\n      e.preventDefault()\n      if (Object.keys(validationErrors).length) {\n        return lifecycle.error()\n      } else {\n        lifecycle.submit()\n        sendApiRequest('submit-form', form.fields)\n          .then(lifecycle.success, lifecycle.error)\n      }\n    }}\u003e\n      {form.error \u0026\u0026 \u003cp\u003eLooks like there was a submission error: {form.error}\u003c/p\u003e}\n      {validationErrors.email \u0026\u0026 !form.pristine \u0026\u0026\n        \u003cp\u003e{validationErrors.email.message}\u003c/p\u003e}\n      \u003cinput value={form.fields.email} type='email' onChange={e =\u003e lifecycle.edit({ email: e.target.value })} /\u003e\n\n      \u003cbutton type='submit' disabled={form.pending}\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n  }} /\u003e\n}\n\nfunction getValidationErrors (form) {\n  return filterBoolean({\n    email: !form.fields.email || !isEmail(form.fields.email)\n      ? new Error('Please enter a valid email.')\n      : null\n  })\n}\n```\n\n## API\n\n## `\u003cFormLifecycle\u003e`\n\n#### Props\n\n#### onChange\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever the form is changed via [`lifecycle` methods](https://github.com/ajoslin/form-lifecycle#lifecyclecreatedata---form). Receives the newForm and prevForm as parameters.\n\n#### onReset\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever `lifecycle.reset` is called\n\n#### onEdit\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever `lifecycle.edit` is called\n\n#### onSubmit\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever `lifecycle.submit` is called\n\n#### onError\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever `lifecycle.error` is called\n\n#### onSuccess\n\n\u003e `function (form, prevForm)` | optional\n\nCalled whenever `lifecycle.success` is called\n\n#### formDefaults\n\n\u003e `object` | optional\n\nThese values will be passed to the new [FormLifecycle object](https://github.com/ajoslin/form-lifecycle) that is created when the component is instantiated.\n\nExample: `\u003cFormLifecycle formDefaults={{ fields: {rememberMe: true} }} /\u003e`\n\n#### render\n\n\u003e `function()` | *required*\n\n`\u003cFormLifecycle render={({ form, lifecycle }) =\u003e \u003cdiv /\u003e} /\u003e`\n\nAlso supports child render function:\n`\u003cFormLifecycle\u003e{({ form, lifecycle }) =\u003e \u003cdiv /\u003e}}\u003c/FormLifecycle\u003e`\n\nThe `render` prop function is called with an object containing the following:\n\n- `form`: An instance of [FormLifecycle](https://github.com/ajoslin/form-lifecycle#api).\n- `lifecycle`: An object containing all [FormLifecycle methods](https://github.com/ajoslin/form-lifecycle#api). When called, the form will be edited and re-rendered.\n  - Example: `lifecycle.edit({ email: 'test@email.com' })`.\n\n## License\n\nMIT © [Andrew Joslin](http://ajoslin.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajoslin%2Freact-form-lifecycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajoslin%2Freact-form-lifecycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajoslin%2Freact-form-lifecycle/lists"}