Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 466 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 466 Rev 467
Línea 10... Línea 10...
10
 
10
 
11
    /**
11
    /**
12
     * Update question answer
12
     * Update question answer
13
     * @param {*} option
13
     * @param {*} option
14
     */
14
     */
15
    const handleAnswer = (option) => {
-
 
16
        console.log(option);
15
    const handleAnswer = () => {
17
        question.answer.includes(option.slug_option) ?
16
        question.answer.includes(option.slug_option) ?
18
            question.answer = removeOption(question.answer, option.slug_option) :
17
            question.answer = removeOption(question.answer, option.slug_option) :
19
            question.answer.push(option.slug_option);
18
            question.answer.push(option.slug_option);
20
        option.checked = true;
-
 
21
        console.log(option);
19
        option.checked = !option.checked;
22
        setChecked(option.checked);
20
        setChecked(option.checked);
Línea 23... Línea 21...
23
    }
21
    }
24
 
22
 
Línea 38... Línea 36...
38
    }, [option]);
36
    }, [option]);
Línea 39... Línea 37...
39
 
37
 
40
 
38
 
41
    return (
-
 
42
        <div>
39
    return (
43
 
40
        <div>
44
            <input
41
            <input
45
                type="checkbox"
42
                type="checkbox"
46
                name={`${option.slug_option}[]`}
43
                name={`${option.slug_option}[]`}
47
                value={option.slug_option}
44
                value={option.slug_option}
48
                checked={checked}
45
                checked={checked}
49
                onChange={() => handleAnswer(option)}
-
 
50
            />
46
                onChange={() => handleAnswer()}
51
 
-
 
52
        </div>
-
 
53
 
47
            />
Línea 54... Línea 48...
54
    )
48
        </div>)
55
}
49
}