Download react-use/stories/useClickAway.story.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/stories/useClickAway.story.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-use/stories/useClickAway.story.tsx
-
curl -L -o useClickAway.story.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/stories/useClickAway.story.tsx
639 Bytes
| import { action } from '@storybook/addon-actions'; | |
| import { storiesOf } from '@storybook/react'; | |
| import * as React from 'react'; | |
| import { useRef } from 'react'; | |
| import { useClickAway } from '../src'; | |
| import ShowDocs from './util/ShowDocs'; | |
| const Demo = () => { | |
| const ref = useRef(null); | |
| useClickAway<MouseEvent>(ref, action('outside clicked')); | |
| return ( | |
| <div | |
| ref={ref} | |
| style={{ | |
| width: 200, | |
| height: 200, | |
| background: 'red', | |
| }} | |
| /> | |
| ); | |
| }; | |
| storiesOf('UI/useClickAway', module) | |
| .add('Docs', () => <ShowDocs md={require('../docs/useClickAway.md')} />) | |
| .add('Demo', () => <Demo />); | |