Skip to main content
Home

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
11 months 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

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@lixquid/util-react

Import symbol

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

Import directly with a jsr specifier

import * as util_react from "jsr:@lixquid/util-react";

Add Package

pnpm i jsr:@lixquid/util-react
or (using pnpm 10.8 or older)
pnpm dlx jsr add @lixquid/util-react

Import symbol

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

Add Package

yarn add jsr:@lixquid/util-react
or (using Yarn 4.8 or older)
yarn dlx jsr add @lixquid/util-react

Import symbol

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

Add Package

npx jsr add @lixquid/util-react

Import symbol

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

Add Package

bunx jsr add @lixquid/util-react

Import symbol

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