In React do ref's reference the virtual DOM, or the actual DOM?

╄→尐↘猪︶ㄣ 提交于 2019-12-02 06:58:17

Refs should reference the actual DOM. One usage of Refs is integrating with third-party DOM libraries, so you can directly modify the DOM using Refs. If Refs reference the virtual DOM, I don't think the demand can be meet. You modify a virtual DOM, but you can't make sure the modification would be synchronized to the actual DOM. Besides, if you want to modify actual DOM when using react, you should always modify the state of components instead of modifying the DOM by Refs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!