我正在尝试将所选日期传递给包含预订组件和预订按钮的组件。我需要为 axios 调用选择的日期。这是 Booking 组件的样子:
function Booking() {
const [value, onChange] = useState(new Date());
const disabledDates = [
new Date(2021, 8, 13),
new Date(2021, 8, 16),
];
console.log(value);
return (
<div className="App">
<Calendar
onChange={onChange}
value={value}
maxDetail="month"
minDetail="month"
tileDisabled={({date, view}) =>
(view === 'month') && // Block day tiles only
disabledDates.some(disabledDate =>
(date.getFullYear() === disabledDate.getFullYear() &&
date.getMonth() === disabledDate.getMonth() &&
date.getDate() === disabledDate.getDate())
)}
/>
</div>
);
}
export default Booking;