From eb1f30af24ca0311ab76e13c2f2cc0724d9a30f9 Mon Sep 17 00:00:00 2001 From: toothlessdev Date: Fri, 22 Nov 2024 22:22:25 +0900 Subject: [PATCH] refactor: CheckBoxWithLabelForm to fit into Question Schema --- src/components/forms/CheckBoxWithLabelForm.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/forms/CheckBoxWithLabelForm.tsx b/src/components/forms/CheckBoxWithLabelForm.tsx index 815daa8..6d155d6 100644 --- a/src/components/forms/CheckBoxWithLabelForm.tsx +++ b/src/components/forms/CheckBoxWithLabelForm.tsx @@ -37,16 +37,15 @@ export const CheckBoxWithLabelForm = ({ ...formState, [questionText]: [ ...formState[questionText], - { value: true }, + { value: option.value }, ], }); } else { setFormState({ ...formState, - [questionText]: [ - ...formState[questionText], - { value: false }, - ], + [questionText]: formState[questionText].filter( + (state) => state.value !== option.value, + ), }); } }}