Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-changes-hook

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-changes-hook - npm Package Compare versions

Comparing version 0.0.1 to 0.7.0

esm/index.d.ts

83

package.json
{
"name": "tree-changes-hook",
"version": "0.0.1",
"description": "",
"main": "index.js",
"version": "0.7.0",
"description": "React hook for tree-changes",
"author": "Gil Barbara <gilbarbara@gmail.com>",
"keywords": [
"comparison",
"tree",
"react",
"hook"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/gilbarbara/tree-changes.git"
},
"bugs": {
"url": "https://github.com/gilbarbara/tree-changes/issues"
},
"homepage": "https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes-hook#readme",
"main": "lib/index.js",
"module": "esm/index.js",
"files": [
"esm",
"lib",
"src"
],
"types": "lib",
"sideEffects": false,
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0"
},
"dependencies": {
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.1",
"fast-deep-equal": "^3.1.3",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^17.0.1",
"tree-changes": "^0.7.0"
},
"devDependencies": {
"del-cli": "^3.0.1",
"typescript": "^4.1.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "npm run clean && npm run build:cjs && npm run build:esm",
"build:cjs": "tsc",
"build:esm": "tsc -m es6 --outDir esm",
"watch:cjs": "npm run build:cjs -- -w",
"watch:esm": "npm run build:esm -- -w",
"lint": "eslint --ext .ts,.tsx src test",
"clean": "del lib/* && del esm/*",
"test": "jest",
"test:coverage": "jest --coverage --bail",
"test:watch": "jest --watchAll --verbose",
"format": "prettier \"**/*.{js,jsx,json,yml,yaml,css,less,scss,ts,tsx,md,graphql,mdx}\" --write",
"validate": "npm run lint && npm run test:coverage && npm run build && npm run size",
"size": "size-limit",
"prepublishOnly": "npm run validate"
},
"keywords": [],
"author": "Gil Barbara <gilbarbara@gmail.com>",
"license": "MIT"
"prettier": {
"trailingComma": "all",
"singleQuote": true,
"arrowParens": "avoid",
"printWidth": 100,
"proseWrap": "never"
},
"size-limit": [
{
"path": "./lib/index.js",
"limit": "3 kB"
},
{
"path": "./esm/index.js",
"limit": "3 kB"
}
],
"gitHead": "1d185e339da99e3761b43aaa60e99a9a6bc6aba2"
}
# tree-changes-hook
React hook for [tree-changes](https://github.com/gilbarbara/tree-changes).
[![NPM version](https://badge.fury.io/js/tree-changes-hook.svg)](https://www.npmjs.com/package/tree-changes-hook) [![build status](https://travis-ci.org/gilbarbara/tree-changes.svg)](https://travis-ci.org/gilbarbara/tree-changes) [![Maintainability](https://api.codeclimate.com/v1/badges/93528e49029782f5f7d2/maintainability)](https://codeclimate.com/github/gilbarbara/tree-changes/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/93528e49029782f5f7d2/test_coverage)](https://codeclimate.com/github/gilbarbara/tree-changes/test_coverage)
React hook that uses [tree-changes](https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes) to compare changes between two datasets.
## Setup
```bash
npm install tree-changes-hook
```
## Usage
```typescript
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](https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes) README for detailed usage.
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc