Skip to content

Commit 8020bfd

Browse files
authored
Remove useState antipattern
Can cause issues if updates are batched
1 parent af16ba4 commit 8020bfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/Header/Hamburger.component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const Hamburger = () => {
5959
id="hamburgersvg"
6060
style={showHamburgerHideXAnimation}
6161
onClick={() => {
62-
setisExpanded(!isExpanded);
62+
setisExpanded(prevExpanded => !prevExpanded);
6363
}}
6464
className="text-gray-900 fill-current"
6565
xmlns="http://www.w3.org/2000/svg"
@@ -73,7 +73,7 @@ const Hamburger = () => {
7373
<animated.svg
7474
id="xsvg"
7575
onClick={() => {
76-
setisExpanded(!isExpanded);
76+
setisExpanded(prevExpanded => !prevExpanded);
7777
}}
7878
style={showXHideHamburgerAnimation}
7979
xmlns="http://www.w3.org/2000/svg"

0 commit comments

Comments
 (0)