HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
💌
JJong’s Archive
/
🐻
고민곰인
/
왜 ref.current는 항상 새로운 값을 참조할까?

왜 ref.current는 항상 새로운 값을 참조할까?

Status
In progress
Tags
생성 일시
Apr 29, 2025 02:05 AM

ref는…

  • 리렌더링해도 객체(ref)는 그대로 살아있음
  • current 값을 업데이트하면, 다음 이벤트 핸들러 호출 때는 수정된 current를 직접 읽어옴
  • 항상 최신 값을 참조
 
리렌더링 사이클과 무관하게 메모리 어딘가에 살아있는 “포인터” 같은 것!!