Children

Type: Class

How to get Children?

JavaScript

import { Children } from 'fds/system';

An alternative to ReactDOM.Children which automatically excludes falsy children: meaning every child that evaluate to false; using !!child, is excluded.

Static properties

count

Type: Function

Count the given React children, automatically excluding falsy children: meaning every child that evaluate to false; using !!child, is excluded.

Arguments

Returns

filter

Type: Function

Loop over the given React children using the given forEachFn, automatically excluding falsy children: meaning every child that evaluate to false; using !!child, is excluded.

Arguments

Returns

forEach

Type: Function

Loop over the given React children using the given forEachFn, automatically excluding falsy children: meaning every child that evaluate to false; using !!child, is excluded.

Arguments

map

Type: Function

Map the given React children using the given mapFn, automatically excluding falsy children: meaning every child that evaluate to false; using !!child, is excluded.

To add/remove certain props on an individual child, use React.cloneElement.

Arguments

toArray

Type: Function

Convert the given React children to a plain JS array, automatically excluding falsy children: meaning every child that evaluate to false; using !!child, is excluded.

Arguments

Returns