Skip to content

Commit cf6a797

Browse files
committed
Add +web-react-mode snippets
1 parent 30a78a2 commit cf6a797

11 files changed

+96
-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+
# name: React component
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: React component class
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: componentDidMount
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: componentDidUpdate
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: componentWillUnmount
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: getDerivedStateFromProps
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: getSnapshotBeforeUpdate
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: shouldComponentUpdate
3+
# contributor: Seong Yong-ju <[email protected]>
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+
# name: useEffect
3+
# contributor: Seong Yong-ju <[email protected]>
4+
# key: useEffect
5+
# --
6+
useEffect(() => {
7+
$0
8+
});

0 commit comments

Comments
 (0)