1.0.3 • Published 6 months ago
reactjs-superhooks v1.0.3
Superhooks
Superhooks is a simple, modern, server-safe React Hooks.
Compatible with React v16.8.0+.
Install
NPM
npm install superhooks
Yarn
yarn add superhooks
PNPM
pnpm install superhooks
Testing
This project uses jest as the testing framework and React Testing Library (RTL) for testing React components and hooks.
Running Tests
To execute all unit tests with coverage enabled
npm run test
Usage
import { useWindowSize } from '../hooks/useWindowSize';
function ExampleComponent() {
const { width, height } = useWindowSize();
return (
<div>
<p>Window width: {width}px</p>
<p>Window height: {height}px</p>
</div>
);
}
export default ExampleComponent;
Contributing
Superhooks is always open to improvements and contributions, you can check the Open Issues if you want to contribute, and it's also possible to request to add your own improvements/ideas using the Feature Request template. Before contributing, please read the Contribution Guide and make sure to respect the standards!
Hooks
useWindowSize()
- Tracks and updates browser window size on resize.useDebounce()
- Delays updating the value until after the specified delay.useLocalStorage()
- Persist a state value in localStorage.
Maintainers
License
MIT