This is a very subjective issue and probably deeply affected by my experience with React, but the name onrender was quite confusing to me. I presumed that onrender would be called every time the component's DOM changed (i.e. every time it is rendered to HTML) rather than just once when the component is added to the document. (By the way, I presume that it's only called when the component is added to the doc based on the code samples; the documentation does not say one way or another.)
Two suggestions:
- Change the documentation's "Lifecycle Hooks" section so that it says clearly exactly when the lifecycle hook functions are called.
- Consider renaming
onrender to onsetup. In my experience, "setup" is more usually used as a counterpart to "teardown". Another possibility would be something like onaddtodocument and onremovefromdocument.
As I say, this is super subjective, but it was legitimately confusing to me while reading over code, even after I figured out that onrender is only called on setup.
Thanks so much!
This is a very subjective issue and probably deeply affected by my experience with React, but the name
onrenderwas quite confusing to me. I presumed thatonrenderwould be called every time the component's DOM changed (i.e. every time it is rendered to HTML) rather than just once when the component is added to the document. (By the way, I presume that it's only called when the component is added to the doc based on the code samples; the documentation does not say one way or another.)Two suggestions:
onrendertoonsetup. In my experience, "setup" is more usually used as a counterpart to "teardown". Another possibility would be something likeonaddtodocumentandonremovefromdocument.As I say, this is super subjective, but it was legitimately confusing to me while reading over code, even after I figured out that
onrenderis only called on setup.Thanks so much!