React - virtual DOM

Minsoo·2022년 2월 22일
0

react

목록 보기
1/1

In javascript, I used to use DOM manipulation (querySelector, getElementById getElementByClassName etc)

But in React, should use "Virtual DOM" so that I will not need to access to DOM directly.

Using useRef(), and then attach the ref to element, access to DOM

Create Ref.
Ref is generated by React.createRef().
through ref attribute, It attached to React element.
when component's instance has created, ref added as property, so that access to ref where component's intatnce is.

profile
Hello all 👋🏻 📍London

0개의 댓글