'In React, is there a central function that gets called every time a render occurs?

When we work with React, and especially app performance, we usually discuss renders.

Is there a central function that gets called every time a component renders?

e.g. React.createElement()?

If so, what is the path where this central function defined in the React repo? i.e. its exact file location. I couldn't find createElement in the repo on Github.

An idea I had was to add a counter to the central render function (e.g. createElement), and then I could print out the total number of renders that occurred when my app ran. It's a huge app with many child components, so a simple way of checking for optimisations is by checking how many renders occur. Unfortunately I do not have access to React Dev Tools.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source