> For the complete documentation index, see [llms.txt](https://shinyongjun.gitbook.io/react-datepicker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shinyongjun.gitbook.io/react-datepicker/docs/onchange.md).

# onChange

### onChange - Datepicker

* component : \<Datepicker />
* requird : false
* type : (activeDate: Date | null) => void;
* default: null

Datepicker 의 Change 이벤트 콜백 함수 입니다.

```tsx
<Datepicker
  onChange={(date) => {
    if (date) {
      alert(`date : ${date?.toString()}`);
    }
  }}
/>
```

### onChange - Rangepicker

* component : \<Rangepicker />
* requird : false
* type : (startDate: Date | null, endDate: Date | null) => void;
* default: null

Rangepicker 의 Change 이벤트 콜백 함수 입니다.

```tsx
<Rangepicker
  onChange={(startDate, endDate) => {
    if (startDate && endDate) {
      alert(`startDate : ${startDate?.toString()}, endDate : ${endDate?.toString()}`);
    }
  }}
/>
```
