import React, { useState } from "react";
import { useDidUpdate } from "rooks";
export default function App() {
const [value, setValue] = useState(0);
useDidUpdate(() => {
console.log("This message was logged on update.");
});
return (
<div>
<p> Update this value by clicking on the button</p>
<p> Current value is {value}</p>
<p> Open the sandbox in codesandbox to view the console </p>
<button onClick={() => setValue(value + 1)}>Increment</button>
</div>
);
}