---
layout: page
---
# onlyText()
Strips all html and returns only text nodes
```typescript
onlyText(children: ReactNode | ReactNode[]): string
```
## Arguments
- children
- The children array from the element where is used.
## Return Value
A string composed by all text nodes in the provided tree.
## Example
```jsx
import React, { ReactElement, ReactNode } from 'react';
import { render } from 'react-dom';
import { onlyText } from 'react-children-utilities';
interface Props {
children?: ReactNode;
}
const OnlyText = ({ children }: Props): ReactElement => {onlyText(children)}
;
const Example = (): ReactElement => (
0
1
2
3
);
render(, document.body);
// Result:
// 0123
```