Description
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.