1.1.1 • Published 8 years ago
add-react-component v1.1.1
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 -fExample
add-react-component example -cGenerates example folder with the following:
index.js
import Example from './example.js'
export default Examplestyle.css
.container {}example.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 Exampleexample.test.js
import React from 'react'
import { shallow } from 'enzyme'
import Example from './example.js'
it('renders without props', () => {
shallow(<Example />)
})License
MIT © Jack Hanford