
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
react-what-changed
Advanced tools
An efficient and simple library to show which dependency changed in a hook between react cycles.
npm install react-what-changed --save-dev
invoke this function again and again on each react's cycle to print which dependency has changed
import { reactWhatChanged } from 'react-what-changed';
Let's say we have the following component
import { reactWhatChanged as RWC } from 'react-what-changed';
function MyComponent(props) {
const [somePrimitive, setSomePrimitive] = useState(123);
const someArray = useSomeArray();
const someObject = useMemo(() => {
return { person: { name: 'John', age: 99 } };
}, [someArray]);
...
...
return <div></div>;
}
Example #1: simplest log as array
useEffect(() => {
someLogic();
}, RWC([somePrimitive, someArray, someObject]));
Example #2: verbose log as array
useEffect(() => {
someLogic();
}, RWC([somePrimitive, someArray, someObject], true));
Example #3: use ID for several logs
useEffect(() => {
someLogic();
}, RWC([somePrimitive], false, 'id_1'));
useMemo(() => {
someLogic();
}, RWC([someArray], false, 'id_2'));
useCallback(() => {
someLogic();
}, RWC([someObject], false, 'id_3'));
Example #4: log with dependencies names
// Instead of:
useEffect(() => {
someLogic();
}, RWC([
somePrimitive,
someArray,
someObject.person.name,
someObject.person.age,
]);
// Do this:
useEffect(() => {
someLogic();
}, RWC({
primitive: somePrimitive,
arr: someArray,
name: someObject.person.name,
age: someObject.person.age,
});
invoke this function again and again on an object (or array) to print all changes (deep comparison)
import { reactWhatDiff } from 'react-what-changed';
Let's use the same component from reactWhatChanged example.
Example #1: simple log
import { reactWhatDiff as RWD } from 'react-what-changed';
useEffect(() => {
someLogic();
}, [somePrimitive, someArray, RWD(someObject)]);
Example #2: use ID for several logs
useEffect(() => {
someLogic();
}, [somePrimitive, RWD(someArray, 'id_1'), RWD(someObject, 'id_2')]);
print all changes (deep comparison) between 2 objects (or arrays)
import { whatDiff } from 'react-what-changed';
Example #1: log the diffs between 2 objects
import { whatDiff as WD } from 'react-what-changed';
const obj1 = { name: 'John', address: { city: 'New York' } };
const obj2 = { name: 'John', address: { city: 'Paris' } };
WD(obj1, obj2);
Let's use the same component from reactWhatChanged example.
Example #2: simple log in a react component
const originalObject = useRef(someObject);
someLogic();
WD(someObject, originalObject.current);
React What Changed is APACHE-2.0 licensed.
FAQs
React What Changed - track which dependency changed between cycles
The npm package react-what-changed receives a total of 83 weekly downloads. As such, react-what-changed popularity was classified as not popular.
We found that react-what-changed 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.