@stardust-ui/react-component-ref

  • Version 0.40.0
  • Published
  • 25.9 kB
  • 3 dependencies
  • MIT license

Install

npm i @stardust-ui/react-component-ref
yarn add @stardust-ui/react-component-ref
pnpm add @stardust-ui/react-component-ref

Overview

A set of components and utils to deal with React refs.

Index

Variables

variable Ref

const Ref: React.FunctionComponent<RefProps>;

    variable refPropType

    const refPropType: PropTypes.Requireable<React.Ref<any>>;
    • A checker that matches the React.Ref type.

    Functions

    function handleRef

    handleRef: <N>(ref: React.Ref<N>, node: N) => void;
    • The function that correctly handles passing refs.

      Parameter ref

      An ref object or function

      Parameter node

      A node that should be passed by ref

    function isRefObject

    isRefObject: (ref: any) => ref is React.RefObject<any>;
    • Checks that the passed object is a valid React ref object.

    function toRefObject

    toRefObject: <T extends Node | Window>(node: T) => React.RefObject<T>;
    • Creates a React ref object from existing DOM node.

    Classes

    class RefFindNode

    class RefFindNode extends React.Component<RefProps> {}

      property displayName

      static displayName: string;

        property prevNode

        prevNode: Node;

          property propTypes

          static propTypes:
          | {
          children: PropTypes.Validator<PropTypes.ReactElementLike>;
          innerRef: PropTypes.Validator<React.Ref<any>>;
          }
          | { children?: undefined; innerRef?: undefined };

            method componentDidMount

            componentDidMount: () => void;

              method componentDidUpdate

              componentDidUpdate: (prevProps: RefProps) => void;

                method componentWillUnmount

                componentWillUnmount: () => void;

                  method render

                  render: () => any;

                    class RefForward

                    class RefForward extends React.Component<RefProps> {}

                      property displayName

                      static displayName: string;

                        property handleRefOverride

                        handleRefOverride: (node: HTMLElement) => void;

                          property propTypes

                          static propTypes:
                          | {
                          children: PropTypes.Validator<PropTypes.ReactElementLike>;
                          innerRef: PropTypes.Validator<React.Ref<any>>;
                          }
                          | { children?: undefined; innerRef?: undefined };

                            method render

                            render: () => React.ReactElement<
                            any,
                            | string
                            | ((props: any) => React.ReactElement<any, any>)
                            | (new (props: any) => React.Component<any, any, any>)
                            >;

                              Interfaces

                              interface RefProps

                              interface RefProps {}

                                property children

                                children: React.ReactElement<any>;

                                  property innerRef

                                  innerRef: React.Ref<any>;
                                  • Called when a child component will be mounted or updated.

                                    Parameter node

                                    Referred node.

                                  Package Files (8)

                                  Dependencies (3)

                                  Dev Dependencies (2)

                                  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/@stardust-ui/react-component-ref.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@stardust-ui/react-component-ref)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/@stardust-ui/react-component-ref"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>