Skip to content

Instantly share code, notes, and snippets.

@JsseL
Last active September 5, 2017 07:42
Show Gist options
  • Save JsseL/ff9a401c5a5e312063bbb78d23a0eefc to your computer and use it in GitHub Desktop.
Save JsseL/ff9a401c5a5e312063bbb78d23a0eefc to your computer and use it in GitHub Desktop.
Sublime snippets
<snippet>
<content><![CDATA[
import React, {PropTypes} from 'react';
const ${1:${TM_FILENAME/(.+)\..+/$1/}} = (props) => {
return (
${4}
);
};
${1:${TM_FILENAME/(.+)\..+/$1/}}.defaultProps = {
${2},
};
${1:${TM_FILENAME/(.+)\..+/$1/}}.propTypes = {
${3},
};
export default ${1:${TM_FILENAME/(.+)\..+/$1/}};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pureComponent</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
import {connect} from 'react-redux';
import ${1:${TM_FILENAME/(.+)\..+/$1/}} from '../components/${1:${TM_FILENAME/(.+)\..+/$1/}}';
const mapStateToProps = (state) => ({
// propName: state.sub.prop,
});
const mapDispatchToProps = (dispatch) => ({
// propName: () => dispatch(actionCreator()),
});
const Connected${1:${TM_FILENAME/(.+)\..+/$1/}} = connect(
mapStateToProps,
mapDispatchToProps
)(${1:${TM_FILENAME/(.+)\..+/$1/}});
export default Connected${1:${TM_FILENAME/(.+)\..+/$1/}};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>container</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment