diff --git a/striker-ui/components/atoms/ToggleSwitch.tsx b/striker-ui/components/atoms/ToggleSwitch.tsx index 03cc1cdc..400a9e76 100644 --- a/striker-ui/components/atoms/ToggleSwitch.tsx +++ b/striker-ui/components/atoms/ToggleSwitch.tsx @@ -1,4 +1,4 @@ -import { FunctionComponent, useState } from 'react'; +import { FunctionComponent, useEffect, useState } from 'react'; import styled from 'styled-components'; import DEFAULT_THEME from '../../lib/consts/DEFAULT_THEME'; @@ -61,6 +61,11 @@ const ToggleSwitch: FunctionComponent = ({ }) => { const [on, setOn] = useState(checked); + // Update the toggle switch when supplied props change + useEffect(() => { + setOn(checked); + }, [checked]); + return (