1.0.10 • Published 5 months ago

react-basic-utils v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

react-basic-utils

A collection of basic utilities for react

useIsMobile

Returns true if the viewport width is smaller or equal than 1023px. A minimal required width can be passed in as an argument.

const isMobile = useIsMobile(); // useIsMobile(desiredMinWidth)

useScroll

Get the scroll position within a HTMLElement or the window.

const scrollPositionX = useScroll(targetEl, SCROLL_DIRECTION.X);
const scrollPositionY = useScroll(targetEl, SCROLL_DIRECTION.Y);

scrollTo

Scroll to the position of an HTMLElement.

scrollTo(targetEl);

concatClassNames

Concatenate class names optionally.

const activateCssClass = true;
<div
  className={concatClassNames([
    "some-basic-class",
    ["optional-class", activateCssClass],
  ])}
/>;
1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago