improve docs about using portal

This commit is contained in:
Lucy Wang 2020-04-16 01:23:22 +08:00
parent 9165f0b724
commit c76bdb142b

View File

@ -162,16 +162,10 @@ as properties into the React function component.
```cljs
(defn reagent-component []
(r/create-class
{:render (fn [this]
(let [el (.. js/document (getElementById "portal-el"))]
(react-dom/createPortal (r/as-element [:div "foo"]) el)))}))
(react-dom/createPortal (r/as-element [:div "foo"]) el)))
```
TODO: Can this be done without create-class and `:render`.
TODO: This might have problems handling Ratoms, test.
## [Hydrate](https://reactjs.org/docs/react-dom.html#hydrate)
```cljs