useEffectOnce
Introduction
Example
import React from 'react';
function ExampleComponent() {
// useEffectOnce 훅을 사용하여 컴포넌트가 처음으로 마운트될 때에만 실행되는 효과 정의
useEffectOnce(() => {
console.log('Hello World'); // 이 메시지는 컴포넌트가 처음으로 마운트될 때만 출력됨
});
return (
<div>
{/* 컴포넌트의 나머지 UI */}
</div>
);
}
export default ExampleComponent;Hook
Last updated