Getting Started
Overview
This tutorial provides a quick guide on installing and using the @abhushanaj/react-hooks
package.
Installation
To get started, you need to install the package. Use one of the following commands based on your package manager:
Requirements
If you are looking to support React (<=17.x.x)
versions, you will need to provide a polyfill or shim for the following hooks.
useSyncExternalStore
for subscribing and managing external stores. The shim is available here.
Browser support
The library is optimized for modern browsers and is transpiled with ES6 as output target.
Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from node_modules yourselves
Usage
All hooks are named exports, so importing them is straightforward.
-
Import a single hook
-
Import multiple hooks.
You can also import multiple hooks at once.
Example
Conclusion
You’re now set up with @abhushanaj/react-hooks
and ready to enhance your React components with these convenient hooks.
Explore the documentation for each hook to unleash their full potential in your projects.