-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
leonardoadame/svelte
#13Description
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
toonsetup
. In my experience, "setup" is more usually used as a counterpart to "teardown". Another possibility would be something likeonaddtodocument
andonremovefromdocument
.
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!
maraisr, willglynn, aharpervc and edsilv
Metadata
Metadata
Assignees
Labels
No labels