Called method is not setting the state in React app

Hu guys,

So I am working on an app where I have multiple modal windows and each having a back arrow button to close the modal. I am using handleBackButton to set the state of modal to be false. Ideally that should close the modal but it isn’t happening and I am not sure why? I know for sure that the handleBackButton is being called but the setState for some reason isn’t setting the modal window state to false.
Can anyone take a look and let me know what am I missing here?

Here is the link to the code: https://stackblitz.com/edit/godutch-app?file=Components%2FAppDashboard.js

Click on 3 dots at top right and click on “Add new Friend” to open the <AddFriend /> modal component and that’s where you’ll see the ArrowBackIcon icon.

AddFriend dialog is rendered when addFriend in state is truthy, but handleBackButton sets addFriendDialog to false which is not used anywhere :man_shrugging:

And I think its time to split AppDashboard into multiple files.

2 Likes

Ohh shoot, I didn’t see that. How stupid :man_facepalming:
Thank you for your help