levand/quiescent — pull request #37 by mmavko (2014-12-12 09:52:23+00:00)
Title: Adding proper unmounting capabilities.

This little fix enables us to write this kind of wrapper:

```clojure
(q/defcomponent SelfUpdatingWrapper
[]
(letfn [(render [node] (q/render (Main @world) node))]
(q/wrapper
(html [:div])
:onMount (fn [node]
(let [renderer (partial render node)]
(renderer)
(add-watch world "renderer-id" renderer)))
:onWillUnmount (fn [node]
(remove-watch world "renderer-id")
(q/unmount-at-node node)))))
```

Exposing this component like

```clojure
(def ^:export component SelfUpdatingWrapper)
```

gives the ability to use it as a regular component in another ReactJS project:

```javascript
ClojureScriptComponent = React.createClass({
render: function() {
return clojurescriptproject.namespace.component();
}
});
```

Now I can freely mount/unmount `ClojureScriptComponent` within any ReactJS project while it is sandboxed in its own "world". That's what we're doing currently in our project in production.