From 2cd1ab1a8029ba74015ffccddfef5c437e4c1dc0 Mon Sep 17 00:00:00 2001 From: Caleb Luster Date: Tue, 2 Jul 2024 13:58:53 -0500 Subject: [PATCH] fixed toggle error not updating when story book controls changed --- stories/Components/UIcomponents/Buttons/Switch/Switch.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stories/Components/UIcomponents/Buttons/Switch/Switch.jsx b/stories/Components/UIcomponents/Buttons/Switch/Switch.jsx index 8fb0d1586..76e4ec664 100644 --- a/stories/Components/UIcomponents/Buttons/Switch/Switch.jsx +++ b/stories/Components/UIcomponents/Buttons/Switch/Switch.jsx @@ -19,6 +19,10 @@ export function Switch({ }) { const [toggled, setToggled] = useState(isToggled); + useEffect(() => { + setToggled(isToggled); + }, [isToggled]); + const handleToggle = () => { if (state !== 'disabled') { setToggled(!toggled);