Basics

Basic hook usage

Basic hook usage example to get started immediately

import React from 'react'; // No longer necessary in newer React versions
import { useLongPress } from 'use-long-press';

const Example = () => {
  const bind = useLongPress(() => {
    alert('Long pressed!');
  });

  return <button {...bind()}>Press me</button>;
};

Last updated