Render Methods in React JS
The render method must be attached to each React component you create. There is no way around it. It’s part of the pattern that React components demand that is being used. Even though React is so much more than the view layer – making the render method explicit to programming with React, is the reason why React is often considered to be primarily a view-based library.
In this case, rendering isn’t rendering at all. Because the word render implies the visualization of data. So React is more like a set of principles, rather than “a way to make User Interfaces” as many beginners tend to believe after brief familiarity with the library. While you can use any third-party library in addition to React, for example, database IO libraries, React still offers a lot in the way of custom programming that goes behind the view elements. In fact, it demands that you understand how this programming principles work.
The method render() which is usually attached to the React’s own “virtual” DOM is the method that will be executed when your application is loaded into the browser for the first time. And consequently, only when the data in the element it represents should be updated.
We know that the render() method triggers an update of the data set (or state of the component). But when should the data be updated? This will depend on the type of data shown in your components but also a few generic functions that are responsible for updating while it’s being used.