ppeerit-atom-react-snippets package
Atom的React开发Snippets插件
#ReactJs
ppeerit: import empty file [pi]
import '${1:FilePath}'
ppeerit: import empty [pim]
import ${1:Name} from '${2:package}'
ppeerit: import empty with object [pimo]
import {${1:Name}} from '${2:package}'
ppeerit: import react [pimr]
import React from 'react'
ppeerit: import react-dom [pimrd]
import ReactDom from 'react-dom'
ppeerit: import prop-types [pimp]
import PropTypes from 'prop-types'
ppeerit: constructor [pcs]
constructor(props) {
super(props)
}
ppeerit: constructor with state [pcss]
constructor(props) {
super(props)
this.state = {
${1}: ${2}
}
}
ppeerit: render [prd]
render() {
return (${1:<div>Component</div>})
}
ppeerit: state [pst]
this.state = {
${1}: ${2}
}
ppeerit: setState [psst]
this.setState({
${1}: ${2}
})
ppeerit: get state [pgst]
const {${1}} = this.state
ppeerit: get props [pgp]
const {${1}} = this.props
ppeerit: fn es6 define [pfnd]
${1:FunctionName} = (${2}) => {
${3}
}
ppeerit: componentDidMount [pcdm]
componentWillUnmount() {
${1}
}
ppeerit: Create Component [prc]
import React from 'react'
class ${1:MyComponent} extends React.Component {
render() {
return (${2:<div>MyComponent</div>})
}
}
export default ${1}
peerit: Create ReactDom [prc]
import React from 'react'
import ReactDom from 'react-dom'
ReactDOM.render(
${1:<div>component</div>},
document.getElementById('${2:app}')
)
ppeerit: Create Component with constructor[prcc]
import React from 'react'
class ${1:MyComponent} extends React.Component {
constructor(props) {
super(props)
}
render() {
return (${2:<div>MyComponent</div>})
}
}
export default ${1}
ppeerit: Create Component with proptypes[prccp]
import React from 'react'
import PropTypes from 'prop-types'
class ${1:MyComponent} extends React.Component {
render() {
return (${2:<div>MyComponent</div>})
}
}
${1}.propTypes = {}
${1}.defaultProps = {}
export default ${1}
ppeerit: set prop-types[pspt]
${1}.propTypes = {}
ppeerit: default prop-types[pdpt]
${1}.defaultProps = {}
....