Skip to content

Commit

Permalink
fixed toggle error not updating when story book controls changed
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebLuster committed Jul 2, 2024
1 parent c8dfc4e commit 2cd1ab1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stories/Components/UIcomponents/Buttons/Switch/Switch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export function Switch({
}) {
const [toggled, setToggled] = useState(isToggled);

useEffect(() => {
setToggled(isToggled);
}, [isToggled]);

const handleToggle = () => {
if (state !== 'disabled') {
setToggled(!toggled);
Expand Down

0 comments on commit 2cd1ab1

Please sign in to comment.