MCPcopy Create free account
hub / github.com/adobe/react-spectrum / childrenToString

Function childrenToString

packages/dev/s2-docs/src/typography.tsx:14–24  ·  view source on GitHub ↗
(children: ReactNode)

Source from the content-addressed store, hash-verified

12import {useHover} from '@react-aria/interactions';
13
14function childrenToString(children: ReactNode) {
15 if (typeof children === 'string') {
16 return children;
17 }
18
19 if (Array.isArray(children)) {
20 return children.reduce((p, c) => p + childrenToString(c), '');
21 }
22
23 return '';
24}
25
26function anchorId(children: ReactNode) {
27 return childrenToString(children)

Callers 1

anchorIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected