A collection of basic utilities for react
npm install react-basic-utilsA collection of basic utilities for react
Returns true if the viewport width is smaller or equal than 1023px. A minimal required width can be passed in as an argument.
``typescript`
const isMobile = useIsMobile(); // useIsMobile(desiredMinWidth)
Get the scroll position within a HTMLElement or the window.
`typescript`
const scrollPositionX = useScroll(targetEl, SCROLL_DIRECTION.X);
const scrollPositionY = useScroll(targetEl, SCROLL_DIRECTION.Y);
Scroll to the position of an HTMLElement.
`typescript`
scrollTo(targetEl);
Concatenate class names optionally.
`typescript``
const activateCssClass = true;
className={concatClassNames([
"some-basic-class",
["optional-class", activateCssClass],
])}
/>;