Since, when the parser reads your file and executes it, component A immediately executed (and thereby launches the contents of the getResult function), but its result ( return ) is displayed only after a timeout.
Technically, you already have in this.props.children contents of return from getResult on the first render, but you only show it after 3 seconds.
I do not know if this is clear, it is not easy for me to explain this in English.
If you want to call only the code in the render, you must put it in the return .
source share