From 5bcae4f88423919e4a17763ce29e69cf088cc08e Mon Sep 17 00:00:00 2001 From: kaushalyap <24698778+kaushalyap@users.noreply.github.com> Date: Fri, 16 Sep 2022 08:42:03 +0530 Subject: [PATCH] Fixed the challenge 4 expected output when initial state of "showForm" changed to false. Since there can be only one empty message when the initial state of "showForm" changed from true to false. (#5071) --- beta/src/content/learn/you-might-not-need-an-effect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/content/learn/you-might-not-need-an-effect.md b/beta/src/content/learn/you-might-not-need-an-effect.md index 1e24a47e1..1cb4638e5 100644 --- a/beta/src/content/learn/you-might-not-need-an-effect.md +++ b/beta/src/content/learn/you-might-not-need-an-effect.md @@ -1594,7 +1594,7 @@ button { This `Form` component lets you send a message to a friend. When you submit the form, the `showForm` state variable is set to `false`. This triggers an Effect calling `sendMessage(message)`, which sends the message (you can see it in the console). After the message is sent, you see a "Thank you" dialog with an "Open chat" button that lets you get back to the form. -Your app's users are sending way too many messages. To make chatting a little bit more difficult, you've decided to show the "Thank you" dialog *first* rather than the form. Change the `showForm` state variable to initialize to `false` instead of `true`. As soon as you make that change, the console will show that an empty message was sent twice. Something in this logic is wrong! +Your app's users are sending way too many messages. To make chatting a little bit more difficult, you've decided to show the "Thank you" dialog *first* rather than the form. Change the `showForm` state variable to initialize to `false` instead of `true`. As soon as you make that change, the console will show that an empty message was sent. Something in this logic is wrong! What's the root cause of this problem? And how can you fix it?