我想要做的是在日期范围内设置一个日期,但有一个错误是
Type 'Date[]' is not assignable to type '[Date?, Date?]'.
Types of property 'length' are incompatible.
Type 'number' is not assignable to type '0 | 1 | 2'
代码:
const [ dateRange, setDateRange] = useState([new Date('2017-02-01'), new Date('2017-05-20')]);
<DateRangePicker
value={dateRange}
onChange={value => {
this.setState({ value });
console.log(value);
}} />