96jd-btn-utils
v18.0.5
Published
Utility for handling buttons
Downloads
111
Maintainers
Readme
96jd-btn-utils
Installation
NPM
npm install 96jd-btn-utils
YARN
yarn add 96jd-btn-utils
PNPM
pnpm add 96jd-btn-utils
BUN
bun add 96jd-btn-utils
Getting started
import { disableButton, enableButton } from "96jd-btn-utils";
import { MouseEvent, useCallback } from "react";
export default function App() {
const disableButton = useCallback((e: MouseEvent) => {
disableButton(e.target as HTMLButtonElement, "Saving");
}, []);
const enableButton = useCallback((e: MouseEvent) => {
enableButton(e.target as HTMLButtonElement);
}, []);
return (
<>
<button onClick={disableButton}>Disable button</button>
<button onClick={enableButton}>Enable button</button>
</>
);
}