forked from YIZHUANG/react-multi-carousel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TypeScriptUsage.md
29 lines (26 loc) · 915 Bytes
/
TypeScriptUsage.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Usage with TypeScript
```js
import * as React from 'react';
import { ButtonGroupProps, ArrowProps, DotProps } from 'react-multi-carousel/lib/types';
interface CustomLeftArrowProps extends ArrowProps {
myOwnStuff: string;
}
interface CarouselButtonGroupProps extends ButtonGroupProps {
className?: string;
}
const CustomLeftArrow = ({ onClick }:CustomLeftArrowProps) => {
return <div onClick={() => onClick()}>This is My custom arrow</div>
}
const CarouselButtonGroup = ({ next, previous }:CarouselButtonGroupProps) => {
return (
<div>
<button onClick={() => previous()} />
<button onClick={() => next()} />
</div>
);
};
const CustomDots = ({ index, active, onClick, carouselState }:DotProps) => {
return <div onClick={() => onClick }>This is a Custom dots</div>
}
```
## [Typescript type definitions >](https://github.com/YIZHUANG/react-multi-carousel/blob/master/src/types.ts)