![](https://tistory1.daumcdn.net/tistory_admin/blogs/image/category/new_ico_5.gif)
useRef 알아보기 useRef란? state와 마찬가지로 특정 값을 저장하지만, state와 다르게 값이 변경되어도 컴포넌트가 다시 렌더링되지 않는다. 즉, 렌더링과 관계없이 내부에서 값을 계속해서 유지하는 역할을 한다. 코드 형태 const ref = useRef(초기값); // { current: 값 } 형태 사용 예시 01 기본 예시import { useRef } from 'react';function Counter() { const countRef = useRef(0); const increase = () => { countRef.current += 1; console.log(countRef.current); }; return ..