如何发送e.target秒值?

时间:2019-01-17 04:45:13

标签: reactjs

我已将e.target输入(onChangeCheckbox),并且无法获取第二个值

function Variant({variant: {id, text}, ...rest}) {
    return (
        <div>
            <CheckBox label={text} value={id} {...rest} />
        </div>
    );
}

Variant.propTypes = {
    variant: PropTypes.shape({
        id: PropTypes.string,
        text: PropTypes.string
    }).isRequired
};
//next file code father
    onChangeCheckbox = e => {
            const {value, label} = e.target;
            const {question: {currentUserAnswerVariants, currentUserAnswerComment, maxAnswersQuantity}, updateQuestion, index} = this.props;
            const answerIndex = currentUserAnswerVariants.indexOf(value);

            console.log(e.target.value);

            if (answerIndex === -1) {
                currentUserAnswerVariants.push(value);
            }

            updateQuestion(index, {
                currentUserAnswerVariants,
                currentUserAnswerComment: currentUserAnswerVariants.indexOf("canComment") === -1 ? null : currentUserAnswerComment
            });
        };

标签未定义,但我在数组How to get text by id from array? React中有此标签

0 个答案:

没有答案