From edb53435443e5a3c01012890f26d90b78947f288 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Wed, 27 Sep 2023 16:10:31 +0200 Subject: [PATCH] better --- docs/data/base/components/portal/portal.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/data/base/components/portal/portal.md b/docs/data/base/components/portal/portal.md index 6eb279c1440690..0af202cccb800f 100644 --- a/docs/data/base/components/portal/portal.md +++ b/docs/data/base/components/portal/portal.md @@ -41,17 +41,18 @@ The following demo shows how a `` nested within a Portal can be appended t ### Server-side -:::error -React doesn't support the [`createPortal()` API](https://react.dev/reference/react-dom/createPortal) on the server. -See [this GitHub issue](https://github.com/facebook/react/issues/13097) for details. -::: - -The Portal component cannot be used to render child elements on the server—client-side hydration is necessary. - -You need to use the `container` callback as the DOM API isn't available on the server: +The DOM API isn't available on the server, you need to use the `container` prop callback. +This callback is called during a React layout effect: ```jsx document.getElementById('filter-panel')!}> ``` + +:::error +The Portal component cannot be used to render child elements on the server—client-side hydration is necessary. + +This is because React doesn't support the [`createPortal()` API](https://react.dev/reference/react-dom/createPortal) on the server. +See [this GitHub issue](https://github.com/facebook/react/issues/13097) for details. +:::