From df9d90764a754d3d165880af3d11685f517bbe6b Mon Sep 17 00:00:00 2001 From: Minu Kim Date: Wed, 6 Sep 2023 04:48:30 -0400 Subject: [PATCH] Fix flushSync.md grammar (#6282) --- src/content/reference/react-dom/flushSync.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/reference/react-dom/flushSync.md b/src/content/reference/react-dom/flushSync.md index 253879b4c..7b40a7389 100644 --- a/src/content/reference/react-dom/flushSync.md +++ b/src/content/reference/react-dom/flushSync.md @@ -89,14 +89,14 @@ import { flushSync } from 'react-dom'; export default function PrintApp() { const [isPrinting, setIsPrinting] = useState(false); - + useEffect(() => { function handleBeforePrint() { flushSync(() => { setIsPrinting(true); }) } - + function handleAfterPrint() { setIsPrinting(false); } @@ -108,7 +108,7 @@ export default function PrintApp() { window.removeEventListener('afterprint', handleAfterPrint); } }, []); - + return ( <>

isPrinting: {isPrinting ? 'yes' : 'no'}

@@ -122,7 +122,7 @@ export default function PrintApp() { -Without `flushSync`, when the print dialog will display `isPrinting` as "no". This is because React batches the updates asynchronously and the print dialog is displayed before the state is updated. +Without `flushSync`, the print dialog will display `isPrinting` as "no". This is because React batches the updates asynchronously and the print dialog is displayed before the state is updated.