Skip to main content

Introduction

  1. Import useSwipeable hook from react-swipeable
  2. Set the swipe handlers you care about
  3. Spread the handlers onto an html tag to bind to the events
import { useSwipeable } from 'react-swipeable';

const handlers = useSwipeable({
onSwiped: (eventData) => console.log("User Swiped!", eventData),
...config,
});
return <div {...handlers}> You can swipe here </div>;

Spread handlers onto the element you wish to track swipes on.

👉 Swipe pattern
Swipe the pattern below, within this box, to make the carousel go to the next slide

Swipe: ⬅️