Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-start-transition
Advanced tools
React 18 startTransition polyfill
With the upcoming startTransition primitive coming to React 18, I decided to create a lil polyfill to help developers transition to the new API and get some perf improvements already.
This lib won't have the same perf impact as the native startTransition
will since it doesn't have access to React internals (more info here) but it will use what's best available and only run the tasks when the browser is not busy doing other more critical stuff.
A combination of isInputPending and requestIdleCallback browser API's will be used for that.
$ yarn add react-start-transition
import * as React from "react";
import { useState } from "react";
import { useTransition } from 'react-start-transition'
const App = () => {
const [isPending, startTransition] = useTransition();
const [inputValue, setInputValue] = useState(5);
const onChange = (value: number) => {
startTransition(() => setInputValue(value));
};
return (
<div>
<Slider defaultValue={inputValue} onChange={onChange} />
<div>{isPending && 'loading...'}</div>
<div>{inputValue}</div>
</div>
);
};
Notice that when you use the isPending
from
const [isPending, startTransition] = useTransition();
it will be coupled to the task that you run within the startTransition
and will done whenever that task get ran by the internal scheduler.
FAQs
React 18 startTransition polyfill
We found that react-start-transition 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.