
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@rc-component/util
Advanced tools
Common Utils For React Component.
(...functions): Function
Create a function which will call all the functions with it's arguments from left to right.
import createChainedFunction from 'rc-util/lib/createChainedFunction';
(prop: string, instead: string, component: string): void
Log an error message to warn developers that prop is deprecated.
import deprecated from 'rc-util/lib/deprecated';
(config: Object): Object
To generate a mixin which will render specific component into specific container automatically.
import getContainerRenderMixin from 'rc-util/lib/getContainerRenderMixin';
Fields in config and their meanings.
| Field | Type | Description | Default |
|---|---|---|---|
| autoMount | boolean | Whether to render component into container automatically | true |
| autoDestroy | boolean | Whether to remove container automatically while the component is unmounted | true |
| isVisible | (instance): boolean | A function to get current visibility of the component | - |
| isForceRender | (instance): boolean | A function to determine whether to render popup even it's not visible | - |
| getComponent | (instance, extra): ReactNode | A function to get the component which will be rendered into container | - |
| getContainer | (instance): HTMLElement | A function to get the container |
Render children to the specific container;
import Portal from 'rc-util/lib/Portal';
Props:
| Prop | Type | Description | Default |
|---|---|---|---|
| children | ReactChildren | Content render to the container | - |
| getContainer | (): HTMLElement | A function to get the container | - |
(fresh?: boolean): number
Get the width of scrollbar.
import getScrollBarSize from 'rc-util/lib/getScrollBarSize';
(): string
To generate a global unique id across current application.
import guid from 'rc-util/lib/guid';
(props: Object): Object
Pick valid HTML attributes and events from props.
import pickAttrs from 'rc-util/lib/pickAttrs';
(msg: string): void
A shallow wrapper of console.warn.
import warn from 'rc-util/lib/warn';
(valid: boolean, msg: string): void
A shallow wrapper of warning, but only warning once for the same message.
import warning, { noteOnce } from 'rc-util/lib/warning';
warning(false, '[antd Component] test hello world');
// Low level note
noteOnce(false, '[antd Component] test hello world');
A collection of functions to operate React elements' children.
(children): children
Return a shallow copy of children.
import mapSelf from 'rc-util/lib/Children/mapSelf';
(children: ReactNode[]): ReactNode[]
Convert children into an array.
import toArray from 'rc-util/lib/Children/toArray';
A collection of functions to operate DOM elements.
(target: ReactNode, eventType: string, listener: Function): { remove: Function }
A shallow wrapper of add-dom-event-listener.
import addEventlistener from 'rc-util/lib/Dom/addEventlistener';
(): boolean
Check if DOM is available.
import canUseDom from 'rc-util/lib/Dom/canUseDom';
A collection of functions to operate DOM nodes' class name.
hasClass(node: HTMLElement, className: string): booleanaddClass(node: HTMLElement, className: string): voidremoveClass(node: HTMLElement, className: string): voidimport cssClass from 'rc-util/lib/Dom/class;
(root: HTMLElement, node: HTMLElement): boolean
Check if node is equal to root or in the subtree of root.
import contains from 'rc-util/lib/Dom/contains';
A collection of functions to get or set css styles.
get(node: HTMLElement, name?: string): anyset(node: HTMLElement, name?: string, value: any) | set(node, object)getOuterWidth(el: HTMLElement): numbergetOuterHeight(el: HTMLElement): numbergetDocSize(): { width: number, height: number }getClientSize(): { width: number, height: number }getScroll(): { scrollLeft: number, scrollTop: number }getOffset(node: HTMLElement): { left: number, top: number }import css from 'rc-util/lib/Dom/css';
A collection of functions to operate focus status of DOM node.
saveLastFocusNode(): voidclearLastFocusNode(): voidbackLastFocusNode(): voidgetFocusNodeList(node: HTMLElement): HTMLElement[] get a list of focusable nodes from the subtree of node.limitTabRange(node: HTMLElement, e: Event): voidimport focus from 'rc-util/lib/Dom/focus';
{ animation: boolean | Object, transition: boolean | Object }
A flag to tell whether current environment supports animationend or transitionend.
import support from 'rc-util/lib/Dom/support';
Enum
Enum of KeyCode, please check the definition of it.
import KeyCode from 'rc-util/lib/KeyCode';
(e: Event): boolean
Whether text and modified key is entered at the same time.
(keyCode: KeyCode): boolean
Whether character is entered.
ScrollLocker<{lock: (options: {container: HTMLElement}) => void, unLock: () => void}>
improve shake when page scroll bar hidden.
ScrollLocker change body style, and add a class ant-scrolling-effect when called, so if you page look abnormal, please check this;
import ScrollLocker from 'rc-util/lib/Dom/scrollLocker';
const scrollLocker = new ScrollLocker();
// lock
scrollLocker.lock()
// unLock
scrollLocker.unLock()
FAQs
Common Utils For React Component
The npm package @rc-component/util receives a total of 359,234 weekly downloads. As such, @rc-component/util popularity was classified as popular.
We found that @rc-component/util demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.