useDocumentEventListener
Aboutβ
A react hook to an event listener to the document object
Installationβ
npm install --save rooks
Importing the hookβ
import { useDocumentEventListener } from 'rooks';
Usageβ
function Demo() {
useDocumentEventListener('click', function () {
console.log('clicked');
});
return null;
}
render(<Demo />);
Codesandbox Examplesβ
Basic Usageβ
Join Bhargav's discord serverβ
You can click on the floating discord icon at the bottom right of the screen and talk to us in our server.