1.1.0 • Published 2 years ago
@nekohack/useful v1.1.0
useful
Installation
Install @nekohack/useful package.
npm i @nekohack/useful
npm i react react-dom
yarn add @nekohack/useful
yarn add react react-dom
Hooks
useHover
Handle the hover element and make changes to it.
import { useHover } from './useHover'
const App = () => {
const [hoverRef, hovering] = useHover<HTMLDivElement>(false)
return <div ref={hoverRef}>{hovering && <div>{'Hovering Test'}</div>}</div>
}
useMount
Handle the mounted state and make changes to it.
import { useMount } from './useMount'
const App = () => {
useMount(() => {
//
})
return <></>
}
useUnmount
Handle the unmounted state and make changes to it.
import { useUnmount } from './useUnmount'
const App = () => {
useUnmount(() => {
//
})
return <></>
}