fix indeterminate state not reseting (#1112)

This commit is contained in:
Thibaut Sardan 2022-07-14 15:54:12 +02:00 committed by GitHub
parent 63d643c3aa
commit 5c163752ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,8 +21,8 @@ function Checkbox ({ checked, className, indeterminate, label, onChange, onClick
const checkboxRef = React.useRef<HTMLInputElement | null>(null);
useEffect(() => {
if (indeterminate && checkboxRef.current) {
checkboxRef.current.indeterminate = true;
if (checkboxRef.current) {
checkboxRef.current.indeterminate = !!indeterminate;
}
}, [indeterminate]);