origen

0.0.6 • Public • Published

ORIGEN

npm GitHub license

A zero dependency, React utility library, filled with useful hooks to make your React experience even better.

useBoolValue

For maintaining the value of a boolean and being able to toggle it's value between true and false;

import { useBoolValue } from 'origen';

export default function App() {
  const [value, toggleValue] = useBoolValue(false);

  return (
    <div>
      <h1>My value is: {value}</h1>
      <button onClick={toggleValue}>Toggle</button>
    </div>
  );
}

useMousePosition

For getting the current x and y coordinates of the mouse cursor.

import { useMousePosition } from 'origen';

export default function App() {
  const mousePosition = useMousePosition();

  return (
    <div>
      <h1>Width: {mousePosition.x}</h1>
      <h1>Height: {mousePosition.y}</h1>   
    </div>
  );
}

useWindowDimensions

For getting the current width and height values of the window.

import { useWindowDimensions } from 'origen';

export default function App() {
  const dimensions = useWindowDimensions();

  return (
    <div>
      <h1>Width: {dimensions.width}</h1>
      <h1>Height: {dimensions.height}</h1>      
    </div>
  );
}

License

ORIGEN is MIT licensed.

Readme

Keywords

Package Sidebar

Install

npm i origen

Weekly Downloads

4

Version

0.0.6

License

MIT

Unpacked Size

19.4 kB

Total Files

12

Last publish

Collaborators

  • askharley