0.1.1 • Published 3 years ago
use-update-effect-hook v0.1.1
useUpdateEffect()
An useEffect that does not run on the first render
Install
npm install use-update-effect-hook
or
yarn add use-update-effect-hook
Quickstart
import { useState } from "react";
import useUpdateEffect from "use-update-effect-hook";
function App() {
const [count, setCount] = useState(10);
useUpdateEffect(() => alert(count), [count]);
return (
<div>
<div>{count}</div>
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
</div>
);
}