@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