UNPKG

343 BTypeScriptView Raw
1import React, { useState } from "react";
2
3import { DayPicker } from "react-day-picker";
4
5export function SingleRequired() {
6 const [selectedDay, setSelectedDay] = useState<Date>();
7
8 return (
9 <DayPicker
10 mode="single"
11 required
12 selected={selectedDay}
13 onSelect={(date) => date && setSelectedDay(date)}
14 />
15 );
16}