什么是React DOM?

使用react开发网页的话,我们难免会下载两个包,一个是react,一个是react-dom,其中react是react的核心代码。react-dom 包提供了 DOM 特定的方法,可以在你的应用程序的顶层使用,如果你需要的话,也可以作为 React模型 之外的特殊操作DOM的接口。 但大多数组件应该不需要使用这个模块。
但是这个中文解释就跟没解释一样,下面参考geeksforgeeks

we all know that reactJS is a library to build active user interface thus rendering(渲染)is one the the integal parts of reactJS, and the way to rendering is through the package called react-dom.
but what exactly is DOM stands for? it’s abbreviation of Document Object Model, it is a standard logical to represent any webpage on browsers. this model is a tree like structure, and it’s containing all the elements and its properities of a website as it’s nodes. it provides a interface that allows accessing and updating of the content of any element of a webpage.
so in short,
ReactDOM is a package that provides DOM specific methods that can be used at the top level of a web app to enable an efficient way of managing DOM elements of the web page. ReactDOM provides the developers with an API containing following methods and a few more.
render()
findDOMNode()
unmountComponentAtNode()
hydrate()
createPortal()

posted @ 2020-10-16 10:29  EvanMeetTheWorld  阅读(104)  评论(0)    收藏  举报