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 | 31 |
Tags
- There isn’t anything to compare
- API 토큰
- getModifierState
- dart 변수
- ngrok설치
- react
- Git
- nextjs 설치
- react env
- fetch
- input type=file
- SCSS
- CSS
- styled components
- icon
- typescript react
- ngrok실행
- rewrites
- react typescript
- github io
- nextjs .env
- git lab
- github
- 컨디셔널 렌더링
- bootstrap
- API token
- createGlobalStyle
- nextjs
- next.js css
- npm styled-reset
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