import { storiesOf } from '@storybook/react'; import * as React from 'react'; import { useEvent, useList } from '../src'; import { CenterStory } from './util/CenterStory'; import ShowDocs from './util/ShowDocs'; const { useCallback } = React; const Demo = () => { const [list, { push, clear }] = useList(); const onKeyDown = useCallback(({ key }) => { if (key === 'r') { clear(); } push(key); }, []); useEvent('keydown', onKeyDown); return (

Press some keys on your keyboard, r key resets the list

{JSON.stringify(list, null, 4)}
); }; storiesOf('Sensors/useEvent', module) .add('Docs', () => ) .add('Demo', () => );