JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24330
  • Score
    100M100P100Q143261F
  • License MIT

React hook for tree-changes

Package Exports

  • tree-changes-hook
  • tree-changes-hook/esm/index.js
  • tree-changes-hook/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tree-changes-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tree-changes-hook

NPM version build status Maintainability Test 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