React Custom Hooks
React Custom Hooks provide an efficient means to encapsulate and share logic among components within React applications.
This package includes useful React custom hooks, such as useKeyboard.
Installation
You can install the package using npm:
npm install react-mkx-toolkit
Or using yarn:
yarn add react-mkx-toolkit
Table of Contents
Browser Support
![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
---|
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
useKeyboard
The useKeyboard
hook is a custom React hook designed to simplify the handling of keyboard events within your React applications. With this hook, you can easily listen for specific keyboard inputs and execute callback functions in response to those inputs.
Usage
import { useKeyboard } from "react-mkx-toolkit";
const MyComponent = () => {
const handleKeyPress = () => {
console.log("The Enter key was pressed!");
};
useKeyboard("Enter", handleKeyPress);
return <>MyComponent</>;
};
export default MyComponent;
useRandomArray
The useRandomArray
hook is a custom React hook designed to simplify the handling of keyboard events within your React applications. With this hook, you can easily listen for specific keyboard inputs and execute callback functions in response to those inputs.
Usage
import { useRandomArray } from "react-mkx-toolkit";
const MyComponent = () => {
const arr = useRandomArray(1, 10);
return <>MyComponent</>;
};
export default MyComponent;
License
This project is licensed under the ISC License.
Author : Mani Kant Sharma