react-component/util

🛠️ Shared React utilities for rc-component packages.

TypeScript

670

608 commits

updated Sep 21, 2026

See the code

README

@rc-component/util

Ant Design Part of the Ant Design ecosystem.

🛠️ Shared React utilities for rc-component packages.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

  • Built for React and maintained by the rc-component team.
  • Used by Ant Design and other React component libraries.
  • Ships TypeScript declarations with both ES module and CommonJS outputs.
  • Keeps examples, tests, and preview builds aligned with the package source.

This package was historically published as rc-util. Prefer the scoped package for new code.

Install

npm install @rc-component/util

Usage

import {
  Portal,
  raf,
  useEvent,
  useLayoutEffect,
  warning,
} from '@rc-component/util';

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers.

AreaExamples
React hooksuseEvent, useLayoutEffect, useMergedState, useState helpers
React utilitiesChildren/toArray, composeRef, pickAttrs, Portal
DOM utilitiesDom/canUseDom, Dom/contains, Dom/dynamicCSS, Dom/focus, getScrollBarSize
Async helpersraf, raf.cancel
Warningswarning, noteOnce, resetWarned
Teststest/domHook for DOM prototype spies

Examples in docs/examples cover the commonly used subpath helpers.

Development

npm install
npm start
npm test
npm run build

The dumi site runs at http://localhost:8000 by default.

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

License

@rc-component/util is released under the MIT license.

antd
ant-design
javascript
react
react-component

react-component/util

🛠️ Shared React utilities for rc-component packages.

TypeScript

670

608 commits

updated Sep 21, 2026

See the code

README

@rc-component/util

Ant Design Part of the Ant Design ecosystem.

🛠️ Shared React utilities for rc-component packages.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

  • Built for React and maintained by the rc-component team.
  • Used by Ant Design and other React component libraries.
  • Ships TypeScript declarations with both ES module and CommonJS outputs.
  • Keeps examples, tests, and preview builds aligned with the package source.

This package was historically published as rc-util. Prefer the scoped package for new code.

Install

npm install @rc-component/util

Usage

import {
  Portal,
  raf,
  useEvent,
  useLayoutEffect,
  warning,
} from '@rc-component/util';

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers.

AreaExamples
React hooksuseEvent, useLayoutEffect, useMergedState, useState helpers
React utilitiesChildren/toArray, composeRef, pickAttrs, Portal
DOM utilitiesDom/canUseDom, Dom/contains, Dom/dynamicCSS, Dom/focus, getScrollBarSize
Async helpersraf, raf.cancel
Warningswarning, noteOnce, resetWarned
Teststest/domHook for DOM prototype spies

Examples in docs/examples cover the commonly used subpath helpers.

Development

npm install
npm start
npm test
npm run build

The dumi site runs at http://localhost:8000 by default.

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

License

@rc-component/util is released under the MIT license.

antd
ant-design
javascript
react
react-component

Project health

Overall

6.1/10

Maintained

10/10

Code review

5/10
OpenSSF Scorecard

Latest release

1.13.0 · Sep 2, 2026

Releases this year

6

Significant stargazers

Jiaren Cai

224 followers · starred Aug 2023

聪小陈

936 followers · starred Mar 2023

stygian-desolator

10 followers · starred Dec 2020

zeqing

28 followers · starred Sep 2018