useRef vs document.getElementById 둘중 어느게 더 좋을까?
프로젝트를 하던 중 DOM을 참조해야 하는 일이 생겼는데 기존 자바스크립트에서 돔을 가져오는 getElementById와 리액트에서의 방식 ref 중 어떤것이 더 나은 방법인가 궁금해서 찾아보았다. In general, refs is better than document.getElementById, because it is more in line with the rest of your react code. 일반적으로, ref가 document.getElementById보다 더 좋다. 왜냐면, 너의 리액트로된 나머지 코드들과 더 잘 맞기 때문이다. In react, every component class can have multiple component instances. 리액트에서는 모든 컴포넌트가 여러..
React
2020. 5. 7. 20:54
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- promise
- Action
- rendering scope
- return type
- Next.js
- await
- es6
- reducer
- storybook
- hydrate
- atomic design
- typescript
- react hooks
- Babel
- mobx
- react
- reactdom
- server side rendering
- useEffect
- type alias
- computed
- state
- javascript
- async
- design system
- useRef
- Polyfill
- webpack
- props
- reflow
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함