[React] Ref
Ref란? - render 메서드에서 생성된 DOM 노드나 React 엘리먼트에 접근하는 방법을 제공. - id와 같은 역할을 하지만, ref에서는 컴포넌트 내부에서만 작동하기 때문에 id중복 문제를 해결할 수 있음. //jquery $("#input").val("abc"); $("#input").focus(); const getValue = $("#input").val(); //react const inputRef = useRef(); inputRef.current.value = "abc"; inputRef.current.focus(); const getValue = inputRef.current.value; ref를 사용해야 하는 경우. - 특정 input에 포커스 주기 - 스크롤박스 조작하기 - c..
SW프로그래밍/React
2021. 3. 11. 17:45
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Props
- javascript
- date
- paging
- list
- 스프링
- Spring
- 클래스형
- value
- java
- typescript
- Redux
- Progressbar
- hooks
- nodeJS
- ajax
- JSON
- script
- 함수형
- html
- hashmap
- datePicker
- JSP
- 리액트
- React
- webpack
- angular
- input
- JSX
- module
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함