[英]airbnb/React-dates, what is the startDateId property?
I have implemented successfully the Reac-dates range as it is explained here , my concern is 我已经成功地实施了REAC-日期范围,因为它是解释在这里 ,我关心的是
What are these props startDateId and endDateId useful for??? 这些道具startDateId和endDateId有什么用?
<DateRangePicker
startDate={this.state.startDate} // momentPropTypes.momentObj or null,
startDateId="your_unique_start_date_id" // PropTypes.string.isRequired,
endDate={this.state.endDate} // momentPropTypes.momentObj or null,
endDateId="your_unique_end_date_id" // PropTypes.string.isRequired,
onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })} // PropTypes.func.isRequired,
focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
onFocusChange={focusedInput => this.setState({ focusedInput })} // PropTypes.func.isRequired,
/>
I know it might be a simple answer but I haven't found an explanation, all it says is that it must be a unique string, I have put it the same string on both properties and it is still working.. 我知道这可能是一个简单的答案,但我还没有找到任何解释,它只是说它必须是一个唯一的字符串,我在两个属性上都使用了相同的字符串,并且仍然可以使用。
It's for accessibility, the input field should be wrapped in a <label>
tag that is also linked to with id
of the input. 为便于访问,输入字段应包装在
<label>
标记中,该标记也与输入的id
链接。 Each id
is supposed to be unique on the page so it can't reliably be generated within the component, hence it is passed as a prop. 每个
id
在页面上都应该是唯一的,因此无法在组件中可靠地生成它,因此它作为prop传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.