React - virtual DOM

khg04170·2022년 2월 22일


목록 보기

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.

Hello all 👋🏻 📍London

0개의 댓글