Docs
React Utils

React Utils

API reference for @udecode/react-utils.

@udecode/react-utils contains utility functions for React.

PortalBody

Renders a React component in the document.body using a portal.

Text

Generic component for rendering a span.

Box

Generic component for rendering a div.

createPrimitiveComponent

Creates a primitive component factory which utilizes hooks for managing state, props, and forwards references to child components.

Parameters

Collapse all

    The base component or native HTML element.

Returns

    A function returning a primitive component with hooks for state and props management.

createPrimitiveElement

Creates a component from an element type.

Parameters

Collapse all

    The native HTML element.

Returns

    A function component that renders the specified element.

createSlotComponent

Creates a Slot component, which is useful when you want a component to behave as its child.

Parameters

Collapse all

    The base component or native HTML element.

Returns

    A function returning a Slot component.

withProviders

A function that wraps a component into multiple providers.

Parameters

Collapse all

    Providers with which to wrap the component.

    If there are any props that you want a provider to receive, you can simply pass an array.

    The component to be wrapped.

    The props to be passed to the wrapped component.

Returns

    A new component that is wrapped by the specified providers.