[React] memo를 사용한 컴포넌트 최적화
·
TypeScript
소개React의 memo 함수는 컴포넌트의 불필요한 리렌더링을 방지하여 성능을 최적화하는 데 사용됩니다. 이번 글에서는 memo의 올바른 사용법과 실제 사례를 살펴보겠습니다.기본 사용법import { memo } from 'react';interface UserProfileProps { name: string; email: string;}const UserProfile = memo(function UserProfile({ name, email }: UserProfileProps) { return ( {name} {email} );});export default UserProfile;memo가 필요한 경우와 필요하지 않은 경우memo가 유용한 경우// 1. 큰 리스트..