APIs

Children.count

Counts nodes in the opaque children structure, including empty nodes within a collection; it does not inspect a child component’s rendered descendants.

Formal Syntax & Structure

react syntaxreact
Children.count(children)

Parameters & Attributes

NameTypeDescription
childrenReact childrenOpaque children value.

Return Value

number

Number of visited child nodes.

Working Example

Example Snippetreact
import { Children } from 'react';console.log(Children.count(['A', null, 'B']));
React Reference