Skip to content

Instantly share code, notes, and snippets.

@joadr
Created October 19, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joadr/7ee858f11ef6d858fd32fc642b0967c9 to your computer and use it in GitHub Desktop.
Save joadr/7ee858f11ef6d858fd32fc642b0967c9 to your computer and use it in GitHub Desktop.
ReactComponent Snippet based on filename
<snippet>
<content><![CDATA[
import React from 'react'
const propTypes = {
}
export default class ${1:${TM_FILENAME/^(\w)|(?:-(\w))|(?:.jsx)/(?1\u$1:)(?2\u$2:)/g:ComponentName}} extends React.Component {
constructor (props) {
super(props)
this.state = {
}
}
render () {
return (
<div>${0}</div>
)
}
}
${TM_FILENAME/^(\w)|(?:-(\w))|(?:.jsx)/(?1\u$1:)(?2\u$2:)/g:ComponentName}.propTypes = propTypes
]]></content>
<tabTrigger>rcomponent</tabTrigger>
<description>Insert React Component</description>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment