Skip to content

Instantly share code, notes, and snippets.

@dgowrie
Last active August 19, 2017 21:10
Show Gist options
  • Select an option

  • Save dgowrie/f6d5957e4835e1bb801a30d51a5d80c7 to your computer and use it in GitHub Desktop.

Select an option

Save dgowrie/f6d5957e4835e1bb801a30d51a5d80c7 to your computer and use it in GitHub Desktop.
Sublime Text Snippet: react_component_stateless.sublime-snippet
<snippet>
<content><![CDATA[
import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
};
function ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}}(${2:props}) {
return (
${3:<div>${0}</div>}
);
}
${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}}.propTypes = propTypes;
export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>react-sfc</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>React: stateless functional component</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment