useUpdateEffect
Introduction
Example
import React, { useState } from "react";
const ExampleComponent = () => {
const [count, setCount] = useState(0);
useUpdateEffect(() => {
console.log("컴포넌트가 업데이트될 때 실행되는 콜백!");
}, [count]);
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount((prevCount) => prevCount + 1)}>Increment Count</button>
</div>
);
};Hook
Last updated