File size: 566 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { useState } from 'react';
import Swipeable from '../index';

const SwipeableExample = () => {
	const [ currentPage, setCurrentPage ] = useState( 0 );

	return (
		<Swipeable
			onPageSelect={ ( index ) => {
				setCurrentPage( index );
			} }
			currentPage={ currentPage }
			pageClassName="example-page-component-class"
			hasDynamicHeight
		>
			<div>Page 1 - Swipe Left</div>
			<div>Page 2 - Swipe Left or Right</div>
			<div>Page 3 - Swipe Right</div>
		</Swipeable>
	);
};

SwipeableExample.displayName = 'Swipeable';
export default SwipeableExample;