It returns a virtual DOM. That's its whole contract. It doesn't return a virtual DOM only within the React framework, if you call it you would get a virtual DOM.
Exactly how often will render() be called, anyway?
You can measure it if you really want to know. It may be useful for optimization sometimes. It is a form of lazy evaluation, so it is more difficult to reason it out, but not impossible.
Although this is somewhat semantic, "render" doesn't really describe what the render() function is actually doing.
You're going directly against this quote:
It is important to remember that the reconciliation algorithm is an implementation detail. React could rerender the whole app on every action; the end result would be the same. [emphasis edited]
You don't see people using allocateAndCopyConcatenate(String s1, String s2) in Java, although that's what the + operator does. (FYI: In Java, don't use + to build new Strings in a loop, use a StringBuilder.)
Remembering exactly what optimizations React uses doesn't help your own optimization. Profile, profile, profile.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It returns a virtual DOM. That's its whole contract. It doesn't return a virtual DOM only within the React framework, if you call it you would get a virtual DOM.
You can measure it if you really want to know. It may be useful for optimization sometimes. It is a form of lazy evaluation, so it is more difficult to reason it out, but not impossible.
You're going directly against this quote:
You don't see people using
allocateAndCopyConcatenate(String s1, String s2)in Java, although that's what the+operator does. (FYI: In Java, don't use+to build newStrings in a loop, use aStringBuilder.)Remembering exactly what optimizations React uses doesn't help your own optimization. Profile, profile, profile.