Skip to content

Commit 101cf3d

Browse files
committed
Use TypeScript in all README examples
1 parent 42b320d commit 101cf3d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ Add React-Date-Picker to your project by executing `npm install react-date-picke
4949

5050
Here's an example of basic usage:
5151

52-
```js
53-
import React, { useState } from 'react';
52+
```tsx
53+
import { useState } from 'react';
5454
import DatePicker from 'react-date-picker';
5555

56+
type ValuePiece = Date | null;
57+
58+
type Value = ValuePiece | [ValuePiece, ValuePiece];
59+
5660
function 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

6973
If 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
7276
import 'react-date-picker/dist/DatePicker.css';
7377
import 'react-calendar/dist/Calendar.css';
7478
```

0 commit comments

Comments
 (0)