Last active
June 9, 2016 21:07
-
-
Save sqrtofsaturn/8d2e64998877ef5a362f1e8f60bc31df to your computer and use it in GitHub Desktop.
React Component Sub Generator templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
import chai, { expect } from 'chai'; | |
import chaiEnzyme from 'chai-enzyme'; | |
import React from 'react'; | |
import sinon from 'sinon'; | |
import sinonChai from 'sinon-chai'; | |
import { mount, shallow } from 'enzyme'; | |
import ComponentName from './'; | |
chai.use(chaiEnzyme()); | |
chai.use(sinonChai); | |
describe('<ComponentName />', () => { | |
it('should render nothing', () => { | |
const sut = shallow(<ComponentName />) | |
expect(sut).to.be.empty | |
}); | |
}); | |
/ComponentName | |
- index.js | |
- index.spec.js | |
- styles.css | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react' | |
const propTypes = {} | |
const defaultProps = {} | |
class StatefulComponent extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = {} | |
} | |
render() { | |
return <div>StatefulComponent</div> | |
} | |
} | |
StatefulComponent.propTypes = propTypes | |
StatefulComponent.defaultProps = defaultProps | |
export default StatefulComponent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react' | |
const propTypes = {} | |
const defaultProps = {} | |
const StatelessComponent = () => { | |
return <div>StatelessComponent</div> | |
} | |
StatelessComponent.propTypes = propTypes | |
StatelessComponent.defaultProps = defaultProps | |
export default StatelessComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment