Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the type of onClick property #5287

Open
Tamir198 opened this issue Dec 22, 2024 · 1 comment
Open

How to change the type of onClick property #5287

Tamir198 opened this issue Dec 22, 2024 · 1 comment

Comments

@Tamir198
Copy link

I would like to know how to do something like this:

  import DatePicker from 'react-datepicker'
  
 <DatePicker onChange={(date) => OnDataChange(date)} />

So far, everything works well, but I have to define OnDataChange like this:

OnDateChange : (date : [Date | null | undefined, Date | null | undefined]) => void

This does not work because it does not align with the library type of onChange.

How can I override this property, I`m using react and typescript.

@DaniilRyb
Copy link

DaniilRyb commented Dec 23, 2024

Hi! if you use two dates as tuple, you can use date range components. For example, created startDate and endDate states

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants