# add-react-component

> Create React Component CLI

Latest version **1.1.1** (published 2017-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install add-react-component
pnpm add add-react-component
yarn add add-react-component
bun add add-react-component
```

Provides the command `add-react-component`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-08-09 |
| First published | 2017-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Maintainers | jackhanford |
| Keywords | react, create, component, purecomponent, cli |

## Links

- npm: https://www.npmjs.com/package/add-react-component
- Repository: https://github.com/hanford/add-react-component
- Issues: https://github.com/hanford/add-react-component/issues
- npm.io page: https://npm.io/package/add-react-component

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ~2.1.0
- [mkdirp](https://npm.io/package/mkdirp.md) ~0.5.1
- [commander](https://npm.io/package/commander.md) ~2.9.0
- [titlecase](https://npm.io/package/titlecase.md) ~1.1.2

## 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

- 1.1.1 (latest) — 2017-08-09
- 1.1.0 — 2017-08-09
- 1.0.0 — 2017-08-09
- 0.1.0 — 2017-08-09

## README

# add-react-component

Generate the component boilerplate, CSS, and a shallow render test with one line.

## Install

Run

```npm install -g add-react-component```

## Usage

```
# Generate PureComponent and shallow render test
$ add-react-component

# Generate PureComponent and shallow render test with stylesheet
$ add-react-component -c

# Generate Functional Component and shallow render test with stylesheet
$ add-react-component -c -f
```

## Example

```sh
add-react-component example -c
```
Generates `example` folder with the following:

`index.js`
```js
import Example from './example.js'

export default Example
```

`style.css`
```css
.container {}
```

`example.js`
```js
import React, { PureComponent } from 'react'

import style from './style.css'

class Example extends PureComponent {
  render () {
    return (
      <div className={style.container}>test</div>
    )
  }
}

export default Example
```

`example.test.js`
```js
import React from 'react'
import { shallow } from 'enzyme'

import Example from './example.js'

it('renders without props', () => {
  shallow(<Example />)
})
```

## License

MIT © [Jack Hanford](http://jackhanford.com)

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