
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.
@rkmodules/use-inner
Advanced tools
This is a very simple wrapper around Reacts useState
. The entire implementation is this:
export const useInner = <T>(
outer: T,
watch?: any[]
): [T, React.Dispatch<React.SetStateAction<T>>] => {
let [inner, setInner] = React.useState<T>(outer);
React.useEffect(() => {
setInner(outer);
}, watch || [outer]);
return [inner, setInner];
};
use useInner
as a local shallow copy of some prop from outside. One place I use this a lot is where a default value is given through props (which may change), but there is also an inner state.
npm install @rkmodules/use-inner
import useInner from "@rkmodules/use-inner";
function LazyInput({ value, onChange }) {
let [inner, setInner] = useInner(value);
// inner now changes whenever value changes, but also on setInner
const handleChange = (e) => {
setInner(e.target.value);
};
const handleBlur = (e) => {
onChange(inner);
};
return <input value={inner} onChange={handleChange} onBlur={handleBlur} />;
}
function LazyArray({ value, onChange }) {
let [inner, setInner] = useInner(value.toUpperCase(), [value]);
// inner now changes whenever value changes, but also on setInner. In this cases also when capitalization changes
const handleChange = (e) => {
setInner(e.target.value);
};
const handleBlur = (e) => {
onChange(inner);
};
return <input value={inner} onChange={handleChange} onBlur={handleBlur} />;
}
# project setup
followed https://www.twilio.com/blog/2017/06/writing-a-node-module-in-typescript.html for project setup
FAQs
internal state react hook that follows an outside state
The npm package @rkmodules/use-inner receives a total of 0 weekly downloads. As such, @rkmodules/use-inner popularity was classified as not popular.
We found that @rkmodules/use-inner 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.