Skip to content

Commit 2cd1ab1

Browse files
committed
fixed toggle error not updating when story book controls changed
1 parent c8dfc4e commit 2cd1ab1

File tree

1 file changed

+4
-0
lines changed
  • stories/Components/UIcomponents/Buttons/Switch

1 file changed

+4
-0
lines changed

stories/Components/UIcomponents/Buttons/Switch/Switch.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export function Switch({
1919
}) {
2020
const [toggled, setToggled] = useState(isToggled);
2121

22+
useEffect(() => {
23+
setToggled(isToggled);
24+
}, [isToggled]);
25+
2226
const handleToggle = () => {
2327
if (state !== 'disabled') {
2428
setToggled(!toggled);

0 commit comments

Comments
 (0)