@lixquid/util-react@0.4.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Utility functions and hooks for a variety of React-style frameworks.
Combines class specifiers into a single class string, for use in class
attributes in HTML or JSX.
Creates a hook that will infinitely generate unique IDs that are stable for
the lifetime of the component. This is typically used for <label for="...">
and <input id="...">
pairs.
Creates a hook that will return a ref object like useRef
, but is
initialized with a value from a callback function. Useful for when you need
to initialize a ref with a value that would be expensive to compute on every
render.
Creates a hook that acts like useState
, but serializes sets to
localStorage, and deserializes initial values from it on first load.
Returns an event handler that will call the callback with the value of the
target element as a float. If the value is not a valid float, the callback
will not be called, unless orElse
is provided, in which case the callback
will be called with that value.
Returns an event handler that will call the callback with the value of the
target element as a integer. If the value is not a valid integer, the
callback will not be called, unless orElse
is provided, in which case the
callback will be called with that value.
Returns an event handler that will call the callback with the value of the
target element. This is mainly used for input
onChange
events.