Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- bootstrap
- nextjs
- rewrites
- CSS
- npm styled-reset
- ngrok설치
- SCSS
- API 토큰
- icon
- next.js css
- git lab
- dart 변수
- react typescript
- nextjs .env
- Git
- github io
- createGlobalStyle
- 컨디셔널 렌더링
- input type=file
- getModifierState
- github
- API token
- ngrok실행
- styled components
- fetch
- nextjs 설치
- typescript react
- There isn’t anything to compare
- react env
- react
Archives
- Today
- Total
목록useref (1)
꾸준히 성장하는 개발자

useRef ref를 넘겨주면, 해당 dom element 를 current에 담아줌 ref는 값이 바뀌어도 컴포넌트가 re-render 되지 않는다 -> 변수들의 값이 유지됨 cf) state변화 -> 렌더링 -> 컴포넌트 내부변수들 초기화 , Ref의 값은 유지된다. react에 의한 re-render가 아닌 실제 document에 존재하는 element를 직접 접근하여 수정 react state로는 관리할 수 없는 경우에만 사용하는 것이 적절하다 사용방법 useRef 불러오기 const ref= useRef(value) const ref = useRef(0); console.log(ref); console.log(ref)으로 불러보면 위처럼 나오는것을 볼수 있다. 그래서 안에 있는 값에 접근을 하고..
React
2022. 5. 23. 03:55