I would like to ask why you need to call mountComponent, recursively. Haven't you already called render inside class to render it all from the very beginning?

if you follow the logic of recursion, inst.render (), will be called every time, but the render method inside class is written at the beginning, does it render the same return value every time? For example:

class Demo extends React.Component {
    constructor(...args) {
        super(...args);
    }
    render() {
        return <div>
            <span>123</span>
            <span>12345</span>
        </div>
    }
}  

Why do you need to call mountComponent, recursively? didn"t you already call render inside class to render it all from the very beginning? Is it rendered by createElement as follows, for example, the second recursion of div, is span for render,. Thank you

React.createElement(
        "div",    // type,,DOMString
        null,
        React.createElement("span", null, "123"),   // children
        React.createElement("span", null, "12345"),
)

the following is part of the source code. The react version is 15.6.0 , git reset-- hard 911603b :

// statelessrenderReactElement
if (renderedElement === undefined) {
  renderedElement = this._renderValidatedComponent();
}

_renderValidatedComponent: function () {
    var renderedComponent;
    ReactCurrentOwner.current = this;
    try {
      renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
    } finally {
      ReactCurrentOwner.current = null;
    }
    return renderedComponent;
},

_renderValidatedComponentWithoutOwnerOrContext: function () {
    var inst = this._instance;
    // renderReactElementJSXbabelcreateElement()
    var renderedComponent = inst.render();
    return renderedComponent;
},

this._renderedComponent = this._instantiateReactComponent(renderedElement);

// 
var markup = ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, this._processChildContext(context));

original link

Mar.11,2021

I haven't read the react source code, but only part of the vue code. Maybe the subject has some misunderstanding

.
Why do you need to call mountComponent, recursively? didn't you already call render inside class to render it all from the very beginning? Is it rendered by createElement as follows, for example, the second recursion of div, is span for render,. Thank you
React.createElement(
        'div',    // type,,DOMString
        null,
        React.createElement('span', null, '123'),   // children
        React.createElement('span', null, '12345'),
)

personally infer that this is only an internal rendering function of react, and it doesn't execute that you write render, inside class depending on how react does it.
react is a framework. When you execute react.render, you don't actually render the render, inside the class directly, but the react framework executes a lot of things inside and finally executes the render function of your class. That's the mountComponent function
, but maybe I'm wrong.
the subject can also take a look at the preact, compression only 3kb. Compact and highly readable.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b394cc-2b4e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b394cc-2b4e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?