From 03b9566e93e195f2b5311a25b3578ed782875f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Boixader=20G=C3=BCell?= Date: Mon, 22 Apr 2024 08:00:27 +0200 Subject: [PATCH] fix: checkbox, default value --- src/guillo-gmi/components/input/checkbox.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/guillo-gmi/components/input/checkbox.tsx b/src/guillo-gmi/components/input/checkbox.tsx index bed5afb..fec897f 100644 --- a/src/guillo-gmi/components/input/checkbox.tsx +++ b/src/guillo-gmi/components/input/checkbox.tsx @@ -33,6 +33,12 @@ export const Checkbox = ({ const inputRef = useRef(null) const [state, setState] = useState(!!checked) + useEffect(() => { + if (state !== checked) { + setState(!!checked) + } + }, [checked]) + useEffect(() => { if (inputRef.current) { inputRef.current.indeterminate = indeterminate