Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-clone-referenced-element
Advanced tools
Changelog
1.1.1
Readme
This is a version of React.cloneElement
that preserves the original element's callback ref even if you specify a new callback ref for the clone.
This library is written for components that use callback refs.
Install this module from npm:
npm install --save react-clone-referenced-element
This library is written in ES2018. Your JavaScript runtime must support trailing commas in function calls and object spread properties. All modern browsers since 2018 support these features.
You will also need to transform or define a global variable named __DEV__
.
The signature of cloneReferencedElement
is the same as that of React.cloneElement
. However, when using callback refs, it will preserve the ref on the original component if there is one.
const original =
<Component ref={component => {
console.log('Running the original ref handler');
}} />;
const clone = cloneReferencedElement(original, {
ref(component) {
console.log('Running the clone ref handler');
},
});
When the component is mounted, the console will display:
Running the clone ref handler
Running the original ref handler
FAQs
Clones a React element while preserving its original ref
The npm package react-clone-referenced-element receives a total of 26,002 weekly downloads. As such, react-clone-referenced-element popularity was classified as popular.
We found that react-clone-referenced-element demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.