From 8322ccd514da0a3ac384f2323ca610f642569f19 Mon Sep 17 00:00:00 2001 From: Kyle Albert <5498623+kalbert312@users.noreply.github.com> Date: Wed, 24 Feb 2021 15:51:06 -0500 Subject: [PATCH] fix(HeaderContainer): use previous state (#7890) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/react/src/components/UIShell/HeaderContainer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/UIShell/HeaderContainer.js b/packages/react/src/components/UIShell/HeaderContainer.js index 01ad54e96a1f..add11ff9aa62 100644 --- a/packages/react/src/components/UIShell/HeaderContainer.js +++ b/packages/react/src/components/UIShell/HeaderContainer.js @@ -16,8 +16,10 @@ const HeaderContainer = ({ isSideNavExpanded, render: Children }) => { ); const handleHeaderMenuButtonClick = useCallback(() => { - setIsSideNavExpandedState(!isSideNavExpandedState); - }, [isSideNavExpandedState, setIsSideNavExpandedState]); + setIsSideNavExpandedState( + (prevIsSideNavExpanded) => !prevIsSideNavExpanded + ); + }, [setIsSideNavExpandedState]); return (