
Security Fundamentals
Turtles, Clams, and Cyber Threat Actors: Shell Usage
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
react-clone-referenced-element
Advanced tools
Clones a React element while preserving its original ref
This is a version of React.cloneElement
that preserves the original element's ref even if you specify a new ref for the clone.
Install this module from npm:
npm install --save react-clone-referenced-element
This library was designed for React Native, so if you are using it with React in other environments, you will need to compile the code first. How you do this is up to you. With Babel, use the following plugins:
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.
let element =
<Component ref={component => {
console.log('Running the original ref handler');
}} />
cloneReferencedElement(element, {
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
1.1.0
React.cloneElement
let
to const
for required modulesFAQs
Clones a React element while preserving its original ref
The npm package react-clone-referenced-element receives a total of 43,188 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 Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
Security News
At VulnCon 2025, NIST scrapped its NVD consortium plans, admitted it can't keep up with CVEs, and outlined automation efforts amid a mounting backlog.
Product
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.