Hi. How to reset value of day picker ?
Here is a possible solution using component state
const DateComponent = () => {
const initialValue = new Date();
const [currentDate, setCurrentDate] = useState( initialValue );
function reset() {
setCurrentDate( initialValue );
}
return (
<DayPicker selectedDays={selectedDate} />
);
};
You could also set key on react-day-picker component and change it whenever you need and it will reset internal state of component. You can read more about it here https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key