0.11.2 • Published 6 months ago

tree-changes-hook v0.11.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

tree-changes-hook

NPM version build status Quality Gate Status Coverage

React hook that uses tree-changes to compare changes between two datasets.

Setup

npm install tree-changes-hook

Usage

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 useEffect without dependencies, but it works with them too.

API

Please refer to tree-changes README for detailed usage.

License

MIT

0.11.2

6 months ago

0.11.0-alpha.0

7 months ago

0.11.0-alpha.1

7 months ago

0.11.0

6 months ago

0.11.1

6 months ago

0.9.3

2 years ago

0.10.0

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.0

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.0.1

3 years ago