# `useEvent` React sensor hook that subscribes a `handler` to events. ## Usage ```jsx import {useEvent, useList} from 'react-use'; 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)}