File tree 1 file changed +8
-4
lines changed
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
49
49
50
50
Here's an example of basic usage:
51
51
52
- ``` js
53
- import React , { useState } from ' react' ;
52
+ ``` tsx
53
+ import { useState } from ' react' ;
54
54
import DatePicker from ' react-date-picker' ;
55
55
56
+ type ValuePiece = Date | null ;
57
+
58
+ type Value = ValuePiece | [ValuePiece , ValuePiece ];
59
+
56
60
function MyApp() {
57
- const [value , onChange ] = useState (new Date ());
61
+ const [value, onChange] = useState < Value > (new Date ());
58
62
59
63
return (
60
64
<div >
@@ -68,7 +72,7 @@ function MyApp() {
68
72
69
73
If you want to use default React-Date-Picker and React-Calendar styling to build upon it, you can import them by using:
70
74
71
- ``` js
75
+ ``` ts
72
76
import ' react-date-picker/dist/DatePicker.css' ;
73
77
import ' react-calendar/dist/Calendar.css' ;
74
78
```
You can’t perform that action at this time.
0 commit comments