{"id":22249863,"url":"https://github.com/dantman/react-pure-events","last_synced_at":"2025-08-20T14:09:17.354Z","repository":{"id":57342862,"uuid":"104492600","full_name":"dantman/react-pure-events","owner":"dantman","description":"A HOC wrapper that makes events props passed to React PureComponents pure","archived":false,"fork":false,"pushed_at":"2020-05-01T02:24:01.000Z","size":10,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-12T01:57:27.063Z","etag":null,"topics":["pure-components","react","react-native","reactjs"],"latest_commit_sha":null,"homepage":null,"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/dantman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-22T15:54:21.000Z","updated_at":"2019-03-28T07:09:11.000Z","dependencies_parsed_at":"2022-09-16T03:02:15.653Z","dependency_job_id":null,"html_url":"https://github.com/dantman/react-pure-events","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dantman/react-pure-events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantman%2Freact-pure-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantman%2Freact-pure-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantman%2Freact-pure-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantman%2Freact-pure-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dantman","download_url":"https://codeload.github.com/dantman/react-pure-events/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantman%2Freact-pure-events/sbom","scorecard":{"id":321865,"data":{"date":"2025-08-11","repo":{"name":"github.com/dantman/react-pure-events","commit":"b19efb57848d5feff744b43589d41b1be6b4be6f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/2 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":"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":"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.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md: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-18T01:34:23.154Z","repository_id":57342862,"created_at":"2025-08-18T01:34:23.154Z","updated_at":"2025-08-18T01:34:23.154Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271330292,"owners_count":24740815,"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-08-20T02:00:09.606Z","response_time":69,"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":["pure-components","react","react-native","reactjs"],"created_at":"2024-12-03T06:32:04.659Z","updated_at":"2025-08-20T14:09:17.331Z","avatar_url":"https://github.com/dantman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"React Pure Events\n=================\n[![npm][npm-badge]][npm]\n[![MIT][license-badge]][license]\n[![dependencies][dependencies-badge]][dependencies]\n[![devDependencies][devDependencies-badge]][devDependencies]\n[![Build Status][travis-ci-badge]][travis-ci]\n[![Codecov][codecov-badge]][codecov]\n\n[npm-badge]: https://img.shields.io/npm/v/react-pure-events.svg\n[npm]: https://www.npmjs.com/package/react-pure-events\n[license-badge]: https://img.shields.io/npm/l/react-pure-events.svg\n[license]: https://github.com/dantman/react-pure-events/blob/master/LICENSE\n[dependencies-badge]: https://img.shields.io/david/dantman/react-pure-events.svg\n[dependencies]: https://david-dm.org/dantman/react-pure-events\n[devDependencies-badge]: https://img.shields.io/david/dev/dantman/react-pure-events.svg\n[devDependencies]: https://david-dm.org/dantman/react-pure-events?type=dev\n[travis-ci-badge]: https://img.shields.io/travis/dantman/react-pure-events.svg\n[travis-ci]: https://travis-ci.org/dantman/react-pure-events\n[codecov-badge]: https://img.shields.io/codecov/c/github/dantman/react-pure-events.svg\n[codecov]: https://codecov.io/gh/dantman/react-pure-events\n\nA HOC wrapper that makes events props passed to React PureComponents pure.\n\nReact Pure Events can be used to make event properties \"pure\" no matter what is passed to your component.\n\nNormally if someone passes `onEvent={() =\u003e {}}` in a render method to your PureComponent it will completely break the PureComponent optimization. Every single render a new function instance will be created so `nextProps.onEvent === prevProps.onEvent` will never be true.\n\nReact Pure Events wraps your PureComponent in a Higher Order Component (HOC) that replaces the function values for any props you define as an event prop with a function that will still call the function passed as a prop, but will not change between renders. Guaranteeing that your PureComponent optimizations work no matter how the caller defines the event.\n\nThe guard version also guarantees that the prop will never be a non-function, so you can safely call `this.props.onEvent()` without testing the type or providing your own noop.\n\n## Installation\n\n```shell\nnpm install --save react-pure-events\n```\n\n## Using\n\n### wrapPureEventProps(...events)\n`wrapPureEventProps` wraps a PureComponent with a HOC that replaces a set of event props with functions that call the event prop, but if passed are the same on every render() call even if the actual function passed to the HOC changes.\n\nThis guarantees that even if a caller uses `onEvent={() =\u003e {}}` which causes a new function instance to be passed every render the PureComponent will always receive the same prop and remain purely optimized.\n\n```js\nimport React, {PureComponent} from 'react';\nimport {wrapPureEventProps} from 'react-pure-events';\n\n// As a decorator\n@wrapPureEventProps('onEvent', 'onEvent2')\nexport default class MyComponent extends PureComponent {\n    onSomethingFinished() {\n        if ( this.props.onEvent ) {\n            this.props.onEvent();\n        }\n    }\n    // ...\n}\n\n// As a function\nclass MyComponent extends PureComponent {\n    // ...\n}\n\nexport default wrapPureEventProps('onEvent', 'onEvent2')(MyComponent);\n```\n\n## guardPureEventProps(...events)\n`guardPureEventProps` does the same as `wrapPureEventProps`, but also guarantees that if an event prop is not a function (not passed or invalid) a noop function will be passed instead.\n\n```js\nimport React, {PureComponent} from 'react';\nimport {guardPureEventProps} from 'react-pure-events';\n\n// As a decorator\n@guardPureEventProps('onEvent', 'onEvent2')\nexport default class MyComponent extends PureComponent {\n    onSomethingFinished() {\n        this.props.onEvent();\n    }\n    // ...\n}\n\n// As a function\nclass MyComponent extends PureComponent {\n    // ...\n}\n\nexport default guardPureEventProps('onEvent', 'onEvent2')(MyComponent);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantman%2Freact-pure-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdantman%2Freact-pure-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantman%2Freact-pure-events/lists"}