DEV Community

loading...

Day Two - Rendering Elements

miral-zymr
・1 min read

In my previous posts, I have written about JSX and few of its concepts. This post will include the rendering of elements in React.

Elements are the smallest building blocks of React apps. It is the smallest renderable unit in React. These elements can be rendered using the ReactDOM. React Elements are plain objects which are easy to render. React Elements and Components are two different terms.

In order to get React elements rendered, they must be enclosed in the div element with id="root" or "app". React elements are immutable i.e. once an element is created it is impossible to update its children or attribute. Hence, to update the element, its render method is to be called several times. React render is quite efficient by using virtual DOM and efficient differentiating algorithm. The algorithm checks the rendered data and the updated data and only re-renders the data that needs an update, instead of rendering all data.

In the next post, I'll be writing about Components and Props in react.

Discussion (0)