Skip to content

Setting and deleting custom properties #106

Description

@coot

Checkout the gist.

This allows to set custom properties on ReactThis within componentWillMount and required to delete them in componentWillUnmount (no memory leaks).

Beyond basic react components setting callbacks on ReactThis is necessary. For example if you want to create a debounced event callback where you need to access to ReactThis you will need to create it in componentWillMount.

I think this approach can be extended to refs (where the render method would be allowed to change the type of This.

We could allow the resulting type of this in componentWillUnmount to be a subrow of what componentWillMount returns. Just the Subrow class from purescript-records fails to recognize that () is a subrow of any non empty row. Maybe that's an actual bug in Union type class.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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