Description:
The package provides two components (ReactWindow and ReactBody) that simplify the management of window and body event listeners. Inspired by svelte.
How to use it:
1. Install and import.
# Yarn $ yarn add @stanko/react-window # NPM $ npm i @stanko/react-window
import ReactWindow from "@stanko/react-window";
import { ReactBody } from "@stanko/react-window";2. Basic usage:
<ReactWindow
onClick={() => {
console.log("Hello world!");
}}
onScroll={() => {
console.log(`Wheeeeee! ${window.scrollY}px`);
}}
/><ReactBody
onClick={() => {
console.log("Hello!");
}}
/>