Skip to content

Commit 22c96ef

Browse files
author
Henrik Lissner
authored
Merge pull request #20 from sei40kr/react-snippets
Add +web-react-mode snippets
2 parents 3a288c9 + 9251f22 commit 22c96ef

11 files changed

+93
-10
lines changed

+web-react-mode/component

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: React component
4+
# key: component
5+
# --
6+
import { Component } from 'react';
7+
8+
const ${1:`(f-base buffer-file-name)`} = (props) => (
9+
$0
10+
);
11+
12+
export default $1;

+web-react-mode/component-class

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: React component class
4+
# key: component-class
5+
# --
6+
import { Component } from 'react';
7+
8+
class ${1:`(f-base buffer-file-name)`} extends Component {
9+
render() {
10+
return (
11+
$0
12+
);
13+
}
14+
}
15+
16+
export default $1;

+web-react-mode/componentDidMount

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: componentDidMount
4+
# key: componentDidMount
5+
# --
6+
componentDidMount() {
7+
$0
8+
}

+web-react-mode/componentDidUpdate

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: componentDidUpdate
4+
# key: componentDidUpdate
5+
# --
6+
componentDidUpdate() {
7+
$0
8+
}

+web-react-mode/componentWillUnmount

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: componentWillUnmount
4+
# key: componentWillUnmount
5+
# --
6+
componentWillUnmount() {
7+
$0
8+
}

+web-react-mode/createClass

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: getDerivedStateFromProps
4+
# key: getDerivedStateFromProps
5+
# --
6+
static getDerivedStateFromProps(nextProps, prevState) {
7+
$0
8+
return null;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: getSnapshotBeforeUpdate
4+
# key: getSnapshotBeforeUpdate
5+
# --
6+
static getSnapshotBeforeUpdate(prevProps, prevState) {
7+
$0
8+
return null;
9+
}

+web-react-mode/shouldComponentUpdate

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: shouldComponentUpdate
4+
# key: shouldComponentUpdate
5+
# --
6+
shouldComponentUpdate(nextProps, nextState) {
7+
$0
8+
}

+web-react-mode/useEffect

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# contributor: Seong Yong-ju <[email protected]>
3+
# name: useEffect
4+
# key: useEffect
5+
# --
6+
useEffect(() => {
7+
$0
8+
});

0 commit comments

Comments
 (0)