Skip to content

Rename onrender/onteardown to oncreate/ondestroy #40

@aickin

Description

@aickin

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:

  1. Change the documentation's "Lifecycle Hooks" section so that it says clearly exactly when the lifecycle hook functions are called.
  2. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions