File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,16 @@ Add React-Date-Picker to your project by executing `npm install react-date-picke
4949
5050Here's an example of basic usage:
5151
52- ``` js
53- import React , { useState } from ' react' ;
52+ ``` tsx
53+ import { useState } from ' react' ;
5454import DatePicker from ' react-date-picker' ;
5555
56+ type ValuePiece = Date | null ;
57+
58+ type Value = ValuePiece | [ValuePiece , ValuePiece ];
59+
5660function MyApp() {
57- const [value , onChange ] = useState (new Date ());
61+ const [value, onChange] = useState < Value > (new Date ());
5862
5963 return (
6064 <div >
@@ -68,7 +72,7 @@ function MyApp() {
6872
6973If you want to use default React-Date-Picker and React-Calendar styling to build upon it, you can import them by using:
7074
71- ``` js
75+ ``` ts
7276import ' react-date-picker/dist/DatePicker.css' ;
7377import ' react-calendar/dist/Calendar.css' ;
7478```
You can’t perform that action at this time.
0 commit comments