Merge pull request #488 from lucywang000/update-docs-about-portal

improve docs about using portal
This commit is contained in:
Juho Teperi 2020-04-16 21:23:17 +03:00 committed by GitHub
commit f0fa602fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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