Skip to content

Commit

Permalink
fix(checkbox): value prop updates internal state
Browse files Browse the repository at this point in the history
  • Loading branch information
elias-oxopia committed Jun 26, 2023
1 parent 546eba8 commit e1cd35e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Checkbox = React.forwardRef<HTMLInputElement, Props>(
const [isChecked, setIsChecked] = useState<boolean>(value ?? false);

useEffect(() => {
// fix
setIsChecked(value ?? false);
}, [value]);

Expand Down

0 comments on commit e1cd35e

Please sign in to comment.