1
0
Fork 0
mirror of synced 2024-12-24 07:43:20 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets

99 lines
1.4 KiB
Text
Raw Normal View History

2016-11-09 12:22:55 -05:00
snippet ir
import React from 'react';
2018-06-14 06:31:12 -04:00
snippet irc
2019-08-22 11:36:17 -04:00
import React, { Component } from 'react';
2016-11-09 12:22:55 -05:00
snippet ird
import ReactDOM from 'react-dom';
snippet cdm
componentDidMount() {
${1}
}
snippet cdup
componentDidUpdate(prevProps, prevState) {
${1}
}
snippet cwm
componentWillMount() {
${1}
}
snippet cwr
componentWillReceiveProps(nextProps) {
${1}
}
snippet cwun
componentWillUnmount() {
${1}
}
snippet cwu
componentWillUpdate(nextProps, nextState) {
${1}
}
snippet fup
forceUpdate(${1:callback});
snippet dp
static defaultProps = {
${1}: ${2},
}
snippet st
state = {
${1}: ${2},
}
snippet pt
static propTypes = {
${1}: React.PropTypes.${2:type},
}
2019-08-22 11:36:17 -04:00
snippet rfc
const ${1:ComponentName} = (${2:props}) => {
return (
<div>
$1
</div>
);
}
2016-11-09 12:22:55 -05:00
snippet rcc
class ${1:ClassName} extends React.Component {
2019-08-22 11:36:17 -04:00
state = {
}
2016-11-09 12:22:55 -05:00
render() {
return (
2019-08-22 11:36:17 -04:00
<div>
$1
</div>
2016-11-09 12:22:55 -05:00
);
}
}
snippet rdr
ReactDOM.render(${1}, ${2})
snippet ercc
export default class ${1:ClassName} extends React.Component {
render() {
return (
${0:<div />}
);
}
}
snippet ctor
constructor() {
super();
${1}
}
snippet ren
render() {
return (
${1:<div />}
);
}
snippet sst
this.setState({
${1}: ${2}
});
snippet scu
shouldComponentUpdate(nextProps, nextState) {
${1}
}
snippet prp i
this.props.${1}
snippet ste i
this.state.${1}