我正在尝试将redux-form与react-semantic-ui一起使用,但Checkbox组件有问题。未选中复选框。我遵循了redux-form文档中的示例,但没有运气。这是代码片段:
renderCheckBox = ({ input, label }) => {
console.log(input.value);
return (
<Form.Field>
<Checkbox
label={label}
checked={input.value ? true : false}
onChange={input.onChange}
/>
</Form.Field>
);
};
<Field
name="activated"
label="Activate?"
component={this.renderCheckBox}
/>
的输出console.log(input.value)
为空。