$ cnpm install tree-changes-hook
React hook that uses tree-changes to compare changes between two datasets.
npm install tree-changes-hook
import React from 'react';
import useTreeChanges from 'tree-changes-hook';
function App(props) {
const { changed } = useTreeChanges(props);
React.useEffect(() => {
if (changed('hasData', true)) {
sendAnalyticsEvent('load', 'MySuperPage');
}
});
return <div>...</div>;
}
It's safe to run all the methods with a
useEffectwithout dependencies, but it works with them too.
Please refer to tree-changes README for detailed usage.
MIT
Copyright 2013 - present © cnpmjs.org | Home |