Summary on React DOM

Pulack Hassan
2 min readNov 4, 2020

React.js is a javascript library. Other competive libraries are- angular.js, vue.js etc. Some topics about reactDOM are summarized below:

ReactDOM: The react-dom package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch to get outside of the React model if you need to. Most of your components should not need to use this module. The methods are described below:

Render: It is used for render react element into DOM. We have to use two API method for rendering.

React DOM.render: This is the entry point for a react application into browser’s DOM. It contains 2 arguments. First argument is the react element to render to the browser. Second element is the place where to render the react element in the browser. React element is a virtual element describing a DOM element. ‘React.createElement’(API method) returns the react element.

React.createElement: This API method creates and return a new react element of the indicated type. It has many arguments. First argument is type; it can be either a tag name string , a React component type (a class or a function), or a React fragment type. The second argument is for any attributes (like id, href, title, etc.) we want the DOM element to have. The third argument is the content of the DOM element.

Hydrate: is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. React will attempt to attach event listeners to the existing markup.

Unmount component at node: unmountComponentAtNode remove a mounted react component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing . Returns true if a component was unmounted and false if there was no comonent to unmount.

Find DOM Node: If this component has been mounted into the DOM, findDOMNode returns the corresponding native browser DOM element. This method is useful for reading values out of the DOM, such as form field values and performing DOM measurements.

Create portal: createPortal creates a portal. Portals provide a way to render children into a DOM node that exists outside the hierarchy of the DOM component.

React DOM Server: This is used typically in node server and enables to render components in static markup.

--

--