I am using the (view, getPos) => … form of the toDom param in Decoration.Widget(). In that function, I am using ReactDOM.Render(). It all works great, except it doesn’t clean up when destroyed. What would be the proper way to detect widget destruction in such a case in order to call react-dom’s unmountComponentAtNode() to clean up?
For now, I am going to see about solving this feature with a NodeView which gives a bit more fidelity to the DOM lifecycle than does a widget.