From b13640a8fb05826f08aecb82ba4c72ba020900d9 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 14 Mar 2022 21:39:59 +0100 Subject: [PATCH] fix: use `globalThis` over `global` (#4448) --- content/blog/2022-03-08-react-18-upgrade-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/blog/2022-03-08-react-18-upgrade-guide.md b/content/blog/2022-03-08-react-18-upgrade-guide.md index fb66b3cb0..15081e219 100644 --- a/content/blog/2022-03-08-react-18-upgrade-guide.md +++ b/content/blog/2022-03-08-react-18-upgrade-guide.md @@ -227,11 +227,11 @@ When you first update your tests to use `createRoot`, you may see this warning i > The current testing environment is not configured to support act(...) -To fix this, set `global.IS_REACT_ACT_ENVIRONMENT` to `true` before running your test: +To fix this, set `globalThis.IS_REACT_ACT_ENVIRONMENT` to `true` before running your test: ```js // In your test setup file -global.IS_REACT_ACT_ENVIRONMENT = true; +globalThis.IS_REACT_ACT_ENVIRONMENT = true; ``` The purpose of the flag is to tell React that it's running in a unit test-like environment. React will log helpful warnings if you forget to wrap an update with `act`.