是否可以根据需要设置 react-day-picker 的输入字段?

Is it possible to set input field of react-day-picker as required?

我在表单中有两个 DayPickerInput 字段,想将它们标记为必填字段,但不知道如何操作。有人可以帮忙吗?

        <FormGroup row>
            <Col md="4">
                <Label htmlFor="begin">Begin</Label>
            </Col>
            <Col xs="12" md="8">
                <DayPickerInput value={this.state.begin}
                                format={settings.formatDate} />
            </Col>
        </FormGroup>
        <FormGroup row>
            <Col md="4">
                <Label htmlFor="end">End</Label>
            </Col>
            <Col xs="12" md="8">
                <DayPickerInput value={this.state.end}
                                format={settings.formatDate} />
            </Col>
        </FormGroup>

更新:我尝试使用 inputProps:

<DayPickerInput inputProps={required} />

但出现错误:

ReferenceError: required is not defined

您必须在表单验证级别实施它。结帐 Formik:

https://github.com/jaredpalmer/formik

I tried with inputProps:

<DayPickerInput inputProps={required} /> 

but got error:

ReferenceError: required is not defined

这是将对象作为道具传递的方法:

<DayPickerInput 
   inputProps={
     { required: true }
   } 
/>