Last active
August 2, 2016 19:19
-
-
Save mikedklein/8d7de319f8c53ac54cb38406925ffc0a to your computer and use it in GitHub Desktop.
Webstorm file templates for react components.
This file contains 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, Component} from 'react'; | |
class ${NAME} extends Component { | |
constructor(props) { | |
super(props); | |
//Set any initial state here | |
} | |
render() { | |
return ( | |
<div> | |
<h1>New Class Based Component</h1> | |
</div> | |
); | |
} | |
} | |
${NAME}.propTypes = { | |
name: PropTypes.string.isRequired | |
}; | |
export default ${NAME}; |
This file contains 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 ${NAME} = () => { | |
return ( | |
<div> | |
<h1>This is the new ${name} component.</h1> | |
</div> | |
); | |
}; | |
${NAME}.propTypes = { | |
name: PropTypes.string.isRequired | |
}; | |
export defualt ${name}; |
This file contains 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, {Component, PropTypes} from 'react'; | |
import {defineMessages, injectIntl} from 'react-intl'; | |
//Define any international Messages here | |
const messages = defineMessages({ | |
example: { | |
id: 'Parent.${NAME}.example', | |
description: 'An example message.', | |
defaultMessage: 'Translate Me.' | |
} | |
}); | |
class ${NAME} extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<div> | |
This will be translated: <br /> | |
{this.props.intl.formatMessage(messages.example)} | |
</div> | |
); | |
} | |
} | |
${NAME}.propTypes = { | |
name: PropTypes.string.isRequired, | |
} | |
export default injectIntl(${NAME}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment