UNPKG

706 BTypeScriptView Raw
1import React, { ReactNode } from 'react';
2/**
3 * ---
4 * category: utilities/react
5 * ---
6 *
7 * Ensure a single child. If it is a child of length 1, return a
8 * cloned instance of the child. If it is a child of length > 1,
9 * wrap in a span and return the child. Return null if child has
10 * no length.
11 * @module ensureSingleChild
12 * @param {ReactNode} child
13 * @param {Object} props - props for child
14 * @returns {ReactElement|null} cloned instance for a single child, or children wrapped in a span
15 */
16declare function ensureSingleChild(child: ReactNode, props?: {}): React.JSX.Element | null;
17export default ensureSingleChild;
18export { ensureSingleChild };
19//# sourceMappingURL=ensureSingleChild.d.ts.map
\No newline at end of file