{"id":16978671,"url":"https://github.com/srph/react-hoc-compose","last_synced_at":"2026-04-17T19:02:07.907Z","repository":{"id":57162192,"uuid":"119091521","full_name":"srph/react-hoc-compose","owner":"srph","description":"Compose factory components on the go for incredibly lazy people","archived":false,"fork":false,"pushed_at":"2018-01-26T21:15:47.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-06T11:25:30.232Z","etag":null,"topics":["react","react-router"],"latest_commit_sha":null,"homepage":"","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/srph.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-26T19:03:34.000Z","updated_at":"2018-02-09T02:12:01.000Z","dependencies_parsed_at":"2022-09-06T16:20:16.077Z","dependency_job_id":null,"html_url":"https://github.com/srph/react-hoc-compose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/srph/react-hoc-compose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-hoc-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-hoc-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-hoc-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-hoc-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srph","download_url":"https://codeload.github.com/srph/react-hoc-compose/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-hoc-compose/sbom","scorecard":{"id":844229,"data":{"date":"2025-08-11","repo":{"name":"github.com/srph/react-hoc-compose","commit":"335049dbeb7bbeb9b810e435f549e6cd2a171cec"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/4 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":"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":"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":"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":"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":"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":"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":"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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-23T21:05:34.933Z","repository_id":57162192,"created_at":"2025-08-23T21:05:34.933Z","updated_at":"2025-08-23T21:05:34.933Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31941845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["react","react-router"],"created_at":"2024-10-14T01:43:57.717Z","updated_at":"2026-04-17T19:02:07.878Z","avatar_url":"https://github.com/srph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## React HOC Compose [![npm version](https://img.shields.io/npm/v/@srph/react-hoc-compose.svg?style=flat-square)](https://npmjs.com/packages/@srph/react-hoc-compose) [![Build Status](https://img.shields.io/travis/srph/react-hoc-compose.svg?style=flat-square)](https://travis-ci.org/srph/react-hoc-compose?branch=master)\nCompose factory components (HOCs) on the go without variable assignment\n\n## Why\nYou may find this useful if you're using [React Router v4](https://github.com/ReactTraining/react-router). The following no longer has \"abstract\" routes:\n\n```js\n\u003cRoute component={App}\u003e\n  \u003cRoute exact path=\"/\" component={AppHome} /\u003e\n\u003c/Route\u003e\n```\n\nIf you do, you'll get the following console warning:\n```\nYou should not use \u003cRoute component\u003e and \u003cRoute children\u003e in the same route; \u003cRoute children\u003e will be ignored\n```\n\nInstead, the library advices on doing the following:\n\n```js\n\u003cApp\u003e\n  \u003cRoute exact path=\"/\" component={AppHome} /\u003e\n\u003c/App\u003e\n```\n\nI use HOCs to apply permissions on each route (the following uses React Router as an example), like so:\n\n```js\n\u003cApp\u003e\n  \u003cRoute path=\"/login\" component={Permission.guest(AppLogin)} /\u003e\n\n  \u003cPermission.auth(AppMain)\u003e\n    \u003cRoute path=\"/\" component={AppHome} /\u003e\n    \u003cRoute path=\"/trash\" component={AppHome} /\u003e\n  \u003c/Permission.auth(AppMain)\u003e\n\u003c/App\u003e\n```\n\nSince `\u003cPermission.auth(AppMain)\u003e` isn't a valid syntax, we will have to assign it to a variable.\n\n```js\nconst AppMainWithPermission = Permission.auth(AppMain)\n```\n\nWhich gets verbose overtime. What if we could compose it on the go?\n\n```js\n\u003cCompose hoc={Permission.auth} component={AppMain}\u003e\n  \u003cRoute path=\"/\" component={AppHome} /\u003e\n  \u003cRoute path=\"/trash\" component={AppHome} /\u003e\n\u003c/Compose\u003e\n```\n\n## How It Works\n`Compose` applies the HOC to the component once, on initial mount.\n\n## Installation\n```bash\nnpm install @srph/react-hoc-compose --save\n```\n\n### Script tags\nIf you're not using a bundler like Browserify or Webpack, simply add the script tag after your React script tag.\n\n```html\n\u003c!-- Script tags for React and other libraries --\u003e\n\u003cscript src=\"https://unpkg.com/@srph/react-hoc-compose/dist/react-hoc-compose.min.js\"\u003e\u003c/script\u003e\n```\n\nThis library is exposed as `ReactHOCCompose` (e.g., `\u003cReactHOCCompose /\u003e`).\n\n## Usage\n```js\n\u003cCompose hoc={withYolo} component={MyComponent} /\u003e\n```\n\n## Contributing\n```\nnpm test\n```\n\n### Bundling package\n```\nnpm run bundle\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Freact-hoc-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrph%2Freact-hoc-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Freact-hoc-compose/lists"}