From a66ebf5e21dad11c765f78f290d3d7e76a6aeffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lasse=20J=C3=B8rgensen?= <28780271+lasjorg@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:19:30 +0200 Subject: [PATCH] fix(curriculum): Check if the element was conditionally rendered (#51747) --- .../react/use-state-to-toggle-an-element.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/03-front-end-development-libraries/react/use-state-to-toggle-an-element.md b/curriculum/challenges/english/03-front-end-development-libraries/react/use-state-to-toggle-an-element.md index d4b7578928d..f282c280a72 100644 --- a/curriculum/challenges/english/03-front-end-development-libraries/react/use-state-to-toggle-an-element.md +++ b/curriculum/challenges/english/03-front-end-development-libraries/react/use-state-to-toggle-an-element.md @@ -65,7 +65,7 @@ assert.strictEqual( ); ``` -Clicking the button element should toggle the `visibility` property in state between `true` and `false`. +Clicking the button element should toggle the `visibility` property in state between `true` and `false` and conditionally render the `h1` element. ```js (() => { @@ -76,11 +76,11 @@ Clicking the button element should toggle the `visibility` property in state bet }; const second = () => { mockedComponent.find('button').simulate('click'); - return mockedComponent.state('visibility'); + return mockedComponent.state('visibility') && mockedComponent.find('h1').exists(); }; const third = () => { mockedComponent.find('button').simulate('click'); - return mockedComponent.state('visibility'); + return mockedComponent.state('visibility') && mockedComponent.find('h1').exists(); }; const firstValue = first(); const secondValue = second();