Skip to main content

Built and signed on GitHub Actions

Utility functions and hooks for a variety of React-style frameworks.

This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
a month ago (0.4.0)

React Utilities

Utility functions and hooks for a variety of React-style frameworks.

Methodology

To allow this library to be used with React, Preact, or any other library that implements the React API, all utilities or hooks are provided via factory functions. This means that to use anything that requires built-in React functionality, you must pass in the required functions as arguments.

For example:

// hooks.ts
import { useRef } from "react";
import { createUseIds } from "@lixquid/util-react";

export const useIds = createUseIds(useRef);
// MyComponent.tsx
import { useIds } from "./hooks";

export function MyComponent() {
  const [id] = useIds();
  return <div id={id}>Hello, world!</div>;
}

It's recommended to create a file that constructs all of the utilities you need and exports them to avoid having to build the utilities every time you need them.

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @lixquid/util-react

Import symbol

import * as mod from "@lixquid/util-react/";

Add Package

npx jsr add @lixquid/util-react

Import symbol

import * as mod from "@lixquid/util-react/";

Add Package

yarn dlx jsr add @lixquid/util-react

Import symbol

import * as mod from "@lixquid/util-react/";

Add Package

pnpm dlx jsr add @lixquid/util-react

Import symbol

import * as mod from "@lixquid/util-react/";

Add Package

bunx jsr add @lixquid/util-react

Import symbol

import * as mod from "@lixquid/util-react/";