From 4a862c06424c47c307c517c8054296222f81564c Mon Sep 17 00:00:00 2001 From: Victor Algaze Date: Thu, 13 Nov 2025 18:53:34 -0800 Subject: [PATCH] Update act() usage to be async in examples The second example uses a synchronous callback to act(), but the docs recommend always using the async version and mention the sync form will be deprecated. This PR updates the example so the callback is async for consistency with current React recommendations. --- src/content/reference/react/act.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/reference/react/act.md b/src/content/reference/react/act.md index 7e1273e3d74..01ed4d01562 100644 --- a/src/content/reference/react/act.md +++ b/src/content/reference/react/act.md @@ -98,7 +98,7 @@ it('can render and update a counter', async () => { document.body.appendChild(container); // ✅ Render the component inside act(). - await act(() => { + await act(async () => { ReactDOMClient.createRoot(container).render(); }); @@ -126,7 +126,7 @@ it.only('can render and update a counter', async () => { const container = document.createElement('div'); document.body.appendChild(container); - await act( async () => { + await act(async () => { ReactDOMClient.createRoot(container).render(); });