1.0.10 • Published 6 months ago

react-basic-utils v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
6 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

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago