origen
v0.0.6
Published
A zero dependency, React utility library, filled with useful hooks to make your React experience even better.
Readme
ORIGEN
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
trueandfalse;
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
xandycoordinates 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
widthandheightvalues 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.
