mirror of
https://github.com/streamich/react-use.git
synced 2026-02-01 14:37:31 +00:00
20 lines
532 B
TypeScript
20 lines
532 B
TypeScript
import { action } from '@storybook/addon-actions';
|
|
import { storiesOf } from '@storybook/react';
|
|
import * as React from 'react';
|
|
import { usePageLeave } from '../src';
|
|
import ShowDocs from './util/ShowDocs';
|
|
|
|
const Demo = () => {
|
|
usePageLeave(action('onPageLeave'));
|
|
|
|
return (
|
|
<div>
|
|
Try leaving the page and see logs in <code>Actions</code> tab.
|
|
</div>
|
|
);
|
|
};
|
|
|
|
storiesOf('Sensors/usePageLeave', module)
|
|
.add('Docs', () => <ShowDocs md={require('../docs/usePageLeave.md')} />)
|
|
.add('Default', () => <Demo />);
|