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.
Checkout the gist.
This allows to set custom properties on
ReactThiswithincomponentWillMountand required to delete them incomponentWillUnmount(no memory leaks).Beyond basic react components setting callbacks on
ReactThisis necessary. For example if you want to create a debounced event callback where you need to access toReactThisyou will need to create it incomponentWillMount.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
componentWillUnmountto be a subrow of whatcomponentWillMountreturns. Just theSubrowclass frompurescript-recordsfails to recognize that()is a subrow of any non empty row. Maybe that's an actual bug inUniontype class.