1.13.0 • Published 25 days ago
@horat1us/react-hooks v1.13.0
React Hooks
Collection of React Hooks and Utils
Install
npm i @horat1us/react-hooks
Usage
import { useOpenState } from "./src";
export const Component = () => {
const [isOpen, changeOpenState] = useOpenState();
return (
<button className={isOpen ? "is-open" : "is-close"} onClick={changeOpenState}>
{isOpen ? "Close" : "Open"}
</button>
);
};
Contents
- useOpenState
- useWindowWidth
- useWindowSize
- useInterval
- useTimeout
- useSubmitCallback - handle FormEvent with custom callback
and
event.preventDefault()
call. - useInputState - controlling input value using state and onChange callback.
- useScrollEffect - auto scroll to element bottom on changes
- useMutationObserver - MutationObserver effect hook with HTMLElement state
- useDocumentTitleEffect - auto scroll to element bottom on changes. Can be used as stateless component:
<DocumentTitle value="string" />
- usePageMeta - changes or adds meta tag.
- usePageInfo - combines useDocumentTitleEffect and usePageMeta.
- useMounted - returns isMounted value for current component using useRef and useEffect.
- usePrint - prints selected DOM element. When use you may use printable.min.css.
Contributors
License
1.13.0
25 days ago
1.12.2
1 year ago
1.12.1
3 years ago
1.12.0
4 years ago
1.11.0
4 years ago
1.10.1
4 years ago
1.10.0
4 years ago
1.9.0
4 years ago
1.8.1
4 years ago
1.8.0
4 years ago
1.7.0
4 years ago
1.6.0
4 years ago
1.5.2
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.1
4 years ago
1.4.0
4 years ago
1.3.0
4 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago