# react-addons-text-content

> Like DOM API's `Node.textContent` and it works in React Element

Latest version **0.0.4** (published 2016-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-addons-text-content
pnpm add react-addons-text-content
yarn add react-addons-text-content
bun add react-addons-text-content
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-06-02 |
| First published | 2016-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Rocky Wu |
| Maintainers | rwu823 |
| Keywords | react, addon, addons, text, content |

## Links

- npm: https://www.npmjs.com/package/react-addons-text-content
- Repository: https://github.com/rwu823/react-addons-text-content
- Homepage: https://github.com/rwu823/react-addons-text-content#readme
- Issues: https://github.com/rwu823/react-addons-text-content/issues
- npm.io page: https://npm.io/package/react-addons-text-content

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2016-06-02
- 0.0.3 — 2016-06-02
- 0.0.2 — 2016-06-02
- 0.0.1 — 2016-06-02

## README

[![version](https://img.shields.io/npm/v/react-addons-text-content.svg?label=version)](https://www.npmjs.org/package/react-addons-text-content) [![Build Status](https://img.shields.io/travis/rwu823/react-addons-text-content.svg?branch=master)](https://travis-ci.org/rwu823/react-addons-text-content/) [![Coverage](https://img.shields.io/coveralls/rwu823/react-addons-text-content.svg)](https://coveralls.io/github/rwu823/react-addons-text-content)

# react-addons-text-content

Like DOM API's `Node.textContent` and it works in React Element

## Install

```sh
$ npm install --save react-addons-text-content
```



## Usage

```javascript
import textContent from 'react-addons-text-content'
 
render() {
  const {children} = this.props
  const text = textContent(children)
  
  return (...)
}
```



## Examples

```javascript
test('should be got text `Hello World`', assert => {
  const Com =
      <div>
        <h1>Hello</h1> World
      </div>

  assert.is(textContent(Com), `Hello World`)
})
```

```javascript
test('array children', assert => {
  const Com = (
    <div>
      <h1>Hello</h1> World
      {
        ['a', <h2>b</h2>]
      }
    </div>
  )
  
  assert.is(textContent(Com), `Hello Worldab`)
})
```

```javascript
test('array component', assert => {
  const Com = (
    [
      <h1>a</h1>, 'b', 'c',
      <div>
        <h2>x</h2>y
      </div>
    ]
  )

  assert.is(textContent(Com), `abcxy`)
})
```



## API

### textContent([React Element])

---
_Source: https://npm.io/package/react-addons-text-content · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
