Skip to content

Instantly share code, notes, and snippets.

@benhorst
Last active June 30, 2017 21:56
Show Gist options
  • Save benhorst/435d2739e075487a921b2d82ef17f82c to your computer and use it in GitHub Desktop.
Save benhorst/435d2739e075487a921b2d82ef17f82c to your computer and use it in GitHub Desktop.
A React boilerplate gist for Atom
'.source.js*':
'react boilerplate':
'prefix': 'rbp'
'body': """
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import './${1:MyComponent}.less';
const ${1:MyComponent} = ({$3}) => (
<div>
$10
</div>
);
${1:MyComponent}.propTypes = {
$5
};
export const Connected${1:MyComponent} = connect(
${6:state => ({
\\}),}
${7:dispatch => ({
\\})}
)(${1:MyComponent});
export default ${1:MyComponent};
"""
@thomplinds
Copy link

thomplinds commented Jun 30, 2017

imports should be changed from:

import React, { PropTypes } from 'react';
import './${1:MyComponent}.less';

to:

import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import './${1:MyComponent}.less';

@benhorst
Copy link
Author

I think it's worth adding more snippets for those!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment