From 0c341e4188ef55d8f6ad009ca8808ac9fce2e272 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Wed, 6 Feb 2019 08:44:27 -0700 Subject: [PATCH 1/2] react-testing-library now supports `act` --- content/blog/2019-02-06-react-v16.8.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/blog/2019-02-06-react-v16.8.0.md b/content/blog/2019-02-06-react-v16.8.0.md index d64e1a768ff..6cf4652dd4f 100644 --- a/content/blog/2019-02-06-react-v16.8.0.md +++ b/content/blog/2019-02-06-react-v16.8.0.md @@ -50,7 +50,7 @@ Even while Hooks were in alpha, the React community created many interesting [ex ## Testing Hooks -We have added a new API called `ReactTestUtils.act()` in this release. It ensures that the behavior in your tests matches what happens in the browser more closely. We recommend to wrap any code rendering and triggering updates to your components into `act()` calls. Testing libraries like [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) can also wrap their APIs with it. +We have added a new API called `ReactTestUtils.act()` in this release. It ensures that the behavior in your tests matches what happens in the browser more closely. We recommend to wrap any code rendering and triggering updates to your components into `act()` calls. Testing libraries like can also wrap their APIs with it (for example, [`react-testing-library`](https://github.com/kentcdodds/react-testing-library)'s `render` and `fireEvent` utilities do this). For example, the counter example from [this page](/docs/hooks-effect.html) can be tested like this: From 04ad6ba409b073dd27ba019f88cb66cf572b1bd1 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Wed, 6 Feb 2019 08:56:01 -0700 Subject: [PATCH 2/2] fix typo --- content/blog/2019-02-06-react-v16.8.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/blog/2019-02-06-react-v16.8.0.md b/content/blog/2019-02-06-react-v16.8.0.md index 6cf4652dd4f..9fe33e8f438 100644 --- a/content/blog/2019-02-06-react-v16.8.0.md +++ b/content/blog/2019-02-06-react-v16.8.0.md @@ -50,7 +50,7 @@ Even while Hooks were in alpha, the React community created many interesting [ex ## Testing Hooks -We have added a new API called `ReactTestUtils.act()` in this release. It ensures that the behavior in your tests matches what happens in the browser more closely. We recommend to wrap any code rendering and triggering updates to your components into `act()` calls. Testing libraries like can also wrap their APIs with it (for example, [`react-testing-library`](https://github.com/kentcdodds/react-testing-library)'s `render` and `fireEvent` utilities do this). +We have added a new API called `ReactTestUtils.act()` in this release. It ensures that the behavior in your tests matches what happens in the browser more closely. We recommend to wrap any code rendering and triggering updates to your components into `act()` calls. Testing libraries can also wrap their APIs with it (for example, [`react-testing-library`](https://github.com/kentcdodds/react-testing-library)'s `render` and `fireEvent` utilities do this). For example, the counter example from [this page](/docs/hooks-effect.html) can be tested like this: