nvim/UltiSnips/javascript.snippets

112 lines
1.4 KiB
Plaintext

snippet todo "// TODO"
// TODO $0
endsnippet
snippet if "if ( ... ) { ... }"
if ($1) {
$0
}
endsnippet
snippet cl "console.log( ... )"
console.log($0);
endsnippet
snippet if "if ( ... ) { ... }"
if ($1) {
$0
}
endsnippet
snippet ifelse "if ( ... ) { ... } else { ... }"
if ($1) {
$2
} else {
$0
}
endsnippet
snippet for "for ( ... ) { ... }"
for (let ${1:index} = ${2:0}; $1 $3; $1${4:++}) {
$0
}
endsnippet
snippet st "setTimeout( ... )"
setTimeout(() => {$0
}, ${1:1000});
endsnippet
snippet jsx "import React ..."
import React from "react";
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
render() {
return (
<${2:div} className={this.props.className}>
$0
</$2>
);
}
}
export default () => (
<S.$1}></S.$1>
);
endsnippet
snippet jsxs "import React ... styled"
import React from "react";
import styled from "styled-components";
const S = {};
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
render() {
return (
<${2:div} className={this.props.className}>
$0
</$2>
);
}
}
S.$1 = styled($1)\`
\`;
export default () => (
<S.$1}></S.$1>
);
endsnippet
snippet jsc "class ... extends React.Component"
class $1 extends React.Component \{
${2: constructor(props) \{
super(props);
this.state = \{
\}
\}}
render() \{
return (
<${3:div}${4: className=\{this.props.className\}}>
$0
</$3>
);
}
}
endsnippet