# react-map-children

> Map React component's children recursively

Latest version **0.1.3** (published 2017-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-map-children
pnpm add react-map-children
yarn add react-map-children
bun add react-map-children
```

## 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.1.3 |
| Published | 2017-07-25 |
| First published | 2017-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | allx |
| Maintainers | allx |
| Keywords | react, map, children, iterate, recursively |

## Links

- npm: https://www.npmjs.com/package/react-map-children
- Repository: https://github.com/udivankin/react-map-children
- Homepage: https://github.com/udivankin/react-map-children#readme
- Issues: https://github.com/udivankin/react-map-children/issues
- npm.io page: https://npm.io/package/react-map-children

## Dependencies (1)

- [babel-preset-react](https://npm.io/package/babel-preset-react.md) ^6.24.1

## 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.1.3 (latest) — 2017-07-25
- 0.1.2 — 2017-07-25
- 0.1.1 — 2017-07-25
- 0.1.0 — 2017-07-24

## README

# React-map-children
Iterates through given React component tree to gather some data

## Install
Via npm:
```bash
npm install --save react-map-children
```

## Usage

```javascript
import React from 'react';
import mapRecursive from 'react-map-children';

const Route = ({ children, path }) => (
  <a href={path}>{children}</a>
);

const routes = (
  <Route path="/">
    <Route path="/index">Index</Route>
    <Route path="/about">About</Route>
    <Route path="/contacts">Contacts</Route>
  </Route>
);

const paths = mapRecursive(
  routes,
  route => (React.isValidElement(route) ? route.props.path : null),
).filter(Boolean);

console.log(paths); // ['/', 'index', 'about', 'contacts']
```

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