@wbe/use-did-update
TypeScript icon, indicating that this package has built-in type declarations

2.7.1 • Public • Published

@wbe/use-did-update

Execute effect only when state or props is updated.

Installation

$ npm install -s @wbe/use-did-update

How to use

import { UseDidUpdate } from "@wbe/use-did-update";

example

const App = ({ count }) => {
  useDidUpdate(() => {
    console.log("Will be called only if count props change");
  }, [count]);
};

Parameters / Props

params type description default value
effect ()=> void effect to execute /
dependencies any[] dependencies array of argument(s) allowing to re-suscribre to the effect /

Returns

void

/@wbe/use-did-update/

    Package Sidebar

    Install

    npm i @wbe/use-did-update

    Weekly Downloads

    4

    Version

    2.7.1

    License

    MIT

    Unpacked Size

    23.1 kB

    Total Files

    18

    Last publish

    Collaborators

    • willybe