rc-util

  • Version 5.44.2
  • Published
  • 243 kB
  • 2 dependencies
  • MIT license

Install

npm i rc-util
yarn add rc-util
pnpm add rc-util

Overview

Common Utils For React Component

Index

Functions

function get

get: (
entity: any,
path: (string | number | symbol)[] | readonly (string | number | symbol)[]
) => any;

    function set

    set: <Entity = any, Output = Entity, Value = any>(
    entity: Entity,
    paths: Path,
    value: Value,
    removeIfUndefined?: boolean
    ) => Output;

      function supportNodeRef

      supportNodeRef: <T = any>(node: React.ReactNode) => node is any;

        function supportRef

        supportRef: (nodeOrComponent: any) => boolean;

          function useComposeRef

          useComposeRef: <T>(...refs: React.Ref<T>[]) => React.Ref<T>;

            function useEvent

            useEvent: <T extends Function>(callback: T) => T;

              function useMergedState

              useMergedState: <T, R = T>(
              defaultStateValue: T | (() => T),
              option?: {
              defaultValue?: T | (() => T);
              value?: T;
              onChange?: (value: T, prevValue: T) => void;
              postState?: (value: T) => T;
              }
              ) => [R, Updater<T>];
              • Similar to useState but will use props value if provided. Note that internal use rc-util useState hook.

              function warning

              warning: typeof warningOnce;
              • See Also

                • Same as warning, but only warn once for the same message

              Namespaces

              namespace warning

              namespace warning {}

                variable noteOnce

                var noteOnce: (valid: boolean, message: string) => void;

                  variable resetWarned

                  var resetWarned: () => void;

                    function preMessage

                    preMessage: (fn: preMessageFn) => void;

                      Package Files (7)

                      Dependencies (2)

                      Dev Dependencies (28)

                      Peer Dependencies (2)

                      Badge

                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rc-util.

                      • Markdown
                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rc-util)
                      • HTML
                        <a href="https://www.jsdocs.io/package/rc-util"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>