# @ecadagiani/reacttools

> My React tools: functions, class, ...

Latest version **1.0.9** (published 2020-03-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @ecadagiani/reacttools
pnpm add @ecadagiani/reacttools
yarn add @ecadagiani/reacttools
bun add @ecadagiani/reacttools
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2020-03-04 |
| First published | 2019-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 30 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Eden Cadagiani |
| Maintainers | ecadagiani |

## Links

- npm: https://www.npmjs.com/package/@ecadagiani/reacttools
- Repository: https://github.com/ecadagiani/reactTools
- Homepage: https://github.com/ecadagiani/reactTools#readme
- Issues: https://github.com/ecadagiani/reactTools/issues
- npm.io page: https://npm.io/package/@ecadagiani/reacttools

## Recent versions

- 1.0.9 (latest) — 2020-03-04
- 1.0.8 — 2020-03-04
- 1.0.7 — 2020-03-04
- 1.0.6 — 2020-03-04
- 1.0.4 — 2020-03-04
- 1.0.3 — 2020-03-04
- 1.0.1 — 2020-03-04
- 1.0.0 — 2019-06-23

## README

# reactTools
My React tools: functions, class, ...

### flattenChildren
Get an indented array of children, return an flat array od this children


### joinChildren
Get an array of component, an render method, and an separator. And return an array of component,
who each component was render with the render method, and are separated by the separator.


### componentTypeStringToComponent
Get an component type in string, return an React component of this type

Example:
```javascript
componentTypeStringToComponent( "textarea" )
```


### isComponent
Test if an var is an React component.

Example:
```javascript
return (
    <>
        {isComponent( MyComponent ) ? <MyComponent /> : MyComponent}
    </>
)
```


### recursePropTypes
To create an recursive prop-types

Example:
```javascript
import PropTypes from "prop-types";

export const formErrors = PropTypes.oneOfType([
    PropTypes.arrayOf( recursePropTypes(() => formErrors )),
    PropTypes.objectOf( recursePropTypes(() => formErrors )),
    PropTypes.shape({
        valid: PropTypes.bool,
        messages: PropTypes.arrayOf( PropTypes.string ),
    }),
]);
```


### mapComponent
Get an array, and a component class, return an array of component,
who each element get an item of array in props.


### mapConnect
Create an array of component, each are connected to redux.

Example:
```javascript
const mapStateToProps = ( state ) => ({
    value: state.value,
});
const mapDispatchToProps = dispatch => ({
    anAction: bindActionCreators(anAction, dispatch ),
});
const MyConnectedComponentArray = mapConnect(
    ( state ) => state.myArray,
    mapStateToProps,
    mapDispatchToProps,
    connect
)( MyComponent );
```

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