init
This commit is contained in:
0
snippets/rjsx-mode/.yas-make-groups
Normal file
0
snippets/rjsx-mode/.yas-make-groups
Normal file
2
snippets/rjsx-mode/.yas-parents
Normal file
2
snippets/rjsx-mode/.yas-parents
Normal file
@@ -0,0 +1,2 @@
|
||||
js-mode
|
||||
js2-mode
|
||||
24
snippets/rjsx-mode/.yas-setup.el
Normal file
24
snippets/rjsx-mode/.yas-setup.el
Normal file
@@ -0,0 +1,24 @@
|
||||
;;; .yas-setup.el --- Yasnippet helper functions for JSX snippets
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'yasnippet)
|
||||
|
||||
(defun yas-jsx-get-class-name-by-file-name ()
|
||||
"Return name of class-like construct by `file-name'."
|
||||
(if buffer-file-name
|
||||
(let ((class-name (file-name-nondirectory
|
||||
(file-name-sans-extension buffer-file-name))))
|
||||
(if (equal class-name "index")
|
||||
(file-name-nondirectory
|
||||
(directory-file-name (file-name-directory buffer-file-name)))
|
||||
class-name))
|
||||
""))
|
||||
|
||||
(defun yas-snake-case (s)
|
||||
"Convert S to snake-case."
|
||||
(mapconcat #'upcase (split-string s "[^[:word:]0-9]+" t) "_"))
|
||||
|
||||
;;; .yas-setup.el ends here
|
||||
10
snippets/rjsx-mode/GraphQL/expgql
Normal file
10
snippets/rjsx-mode/GraphQL/expgql
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ac6e22b0-886b-4a09-861b-c759bfb8fcbe
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportGraphQL
|
||||
# key: expgql
|
||||
# --
|
||||
|
||||
export default compose(
|
||||
graphql(${1:queryOrMutation}, { name: ${2:name} }),
|
||||
)(${1:${TM_FILENAME_BASE}})
|
||||
8
snippets/rjsx-mode/GraphQL/graphql
Normal file
8
snippets/rjsx-mode/GraphQL/graphql
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 1a3750bd-8108-40f5-92b4-f0730272815c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: graphQLForComponent
|
||||
# key: graphql
|
||||
# --
|
||||
|
||||
import { compose, graphql } from 'react-apollo'
|
||||
10
snippets/rjsx-mode/Jest/desc
Normal file
10
snippets/rjsx-mode/Jest/desc
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: edfbca80-e069-46cd-a034-b1523e57c4a4
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: describeBlock
|
||||
# key: desc
|
||||
# --
|
||||
|
||||
describe('$1', () => {
|
||||
$0
|
||||
})
|
||||
27
snippets/rjsx-mode/Jest/snrtest
Normal file
27
snippets/rjsx-mode/Jest/snrtest
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: de59c777-b0cb-40b1-903a-a006987fef2e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactNativeTestWithRedux
|
||||
# key: snrtest
|
||||
# --
|
||||
|
||||
import 'react-native'
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
import store from 'src/store'
|
||||
import ${1:${TM_FILENAME_BASE}} from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(
|
||||
<Provider store={store}>
|
||||
<${1:${TM_FILENAME_BASE}} {...defaultProps} />
|
||||
</Provider>,
|
||||
)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
21
snippets/rjsx-mode/Jest/sntest
Normal file
21
snippets/rjsx-mode/Jest/sntest
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: fae867ad-ec86-4eff-bb90-a9bb07040eb7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactNativeTest
|
||||
# key: sntest
|
||||
# --
|
||||
|
||||
import 'react-native'
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
|
||||
import ${1:${TM_FILENAME_BASE}} from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(<${1:${TM_FILENAME_BASE}} {...defaultProps} />)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
26
snippets/rjsx-mode/Jest/srtest
Normal file
26
snippets/rjsx-mode/Jest/srtest
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 168f89c0-3e0b-4868-b090-50f6fc79d074
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactComponentTestWithRedux
|
||||
# key: srtest
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
import store from 'src/store'
|
||||
import { ${1:${TM_FILENAME_BASE}} } from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(
|
||||
<Provider store={store}>
|
||||
<${1:${TM_FILENAME_BASE}} {...defaultProps} />
|
||||
</Provider>,
|
||||
)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
20
snippets/rjsx-mode/Jest/stest
Normal file
20
snippets/rjsx-mode/Jest/stest
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ddc5cfd4-640f-4fb3-9f85-667de1e4a345
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupTest
|
||||
# key: stest
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
|
||||
import { ${1:${TM_FILENAME_BASE}} } from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(<${1:${TM_FILENAME_BASE}} {...defaultProps} />)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
10
snippets/rjsx-mode/Jest/test
Normal file
10
snippets/rjsx-mode/Jest/test
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 190f78b4-17ec-429e-aaf1-3231726ca580
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: testBlock
|
||||
# key: test
|
||||
# --
|
||||
|
||||
test('should $1', () => {
|
||||
$0
|
||||
})
|
||||
10
snippets/rjsx-mode/Jest/tit
Normal file
10
snippets/rjsx-mode/Jest/tit
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 96dcd16f-ee34-4832-8637-6610819df6ba
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: itBlock
|
||||
# key: tit
|
||||
# --
|
||||
|
||||
it('should $1', () => {
|
||||
$0
|
||||
})
|
||||
8
snippets/rjsx-mode/React-Native/imrn
Normal file
8
snippets/rjsx-mode/React-Native/imrn
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 1eff0de2-eeb3-457f-b935-7a733a03d378
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeImport
|
||||
# key: imrn
|
||||
# --
|
||||
|
||||
import { ${1:moduleName} } from 'react-native'
|
||||
19
snippets/rjsx-mode/React-Native/rnc
Normal file
19
snippets/rjsx-mode/React-Native/rnc
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: c4aa3b3e-82af-434b-acc5-b08bf018e0aa
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponent
|
||||
# key: rnc
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
21
snippets/rjsx-mode/React-Native/rnce
Normal file
21
snippets/rjsx-mode/React-Native/rnce
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 27262af6-b8a7-4165-bbfb-815f62eb3d4f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponentExport
|
||||
# key: rnce
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default $1
|
||||
21
snippets/rjsx-mode/React-Native/rncs
Normal file
21
snippets/rjsx-mode/React-Native/rncs
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 6a9c7016-01b0-4c5c-84d6-28a688d81a4b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponentWithStyles
|
||||
# key: rncs
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, StyleSheet, View } from 'react-native'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({})
|
||||
19
snippets/rjsx-mode/React-Native/rnpc
Normal file
19
snippets/rjsx-mode/React-Native/rnpc
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: d30232be-9660-4736-9fdc-4e50559db3d1
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativePureComponent
|
||||
# key: rnpc
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
21
snippets/rjsx-mode/React-Native/rnpce
Normal file
21
snippets/rjsx-mode/React-Native/rnpce
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: b36666f2-3ac6-4ee7-9f17-b32d82705306
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativePureComponentExport
|
||||
# key: rnpce
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default $1
|
||||
10
snippets/rjsx-mode/React-Native/rnstyle
Normal file
10
snippets/rjsx-mode/React-Native/rnstyle
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 0b1a0e2b-5577-4a15-bbbb-d573376c8587
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeStyles
|
||||
# key: rnstyle
|
||||
# --
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
${1:style}
|
||||
})
|
||||
10
snippets/rjsx-mode/React/cdm
Normal file
10
snippets/rjsx-mode/React/cdm
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: fed15504-4984-4bd8-a6d6-b1f34bccc721
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentDidMount
|
||||
# key: cdm
|
||||
# --
|
||||
|
||||
componentDidMount() {
|
||||
$0
|
||||
}
|
||||
10
snippets/rjsx-mode/React/cdup
Normal file
10
snippets/rjsx-mode/React/cdup
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a283c221-42f9-46f9-abaf-f41ef7f5812c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentDidUpdate
|
||||
# key: cdup
|
||||
# --
|
||||
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
$0
|
||||
}
|
||||
8
snippets/rjsx-mode/React/cp
Normal file
8
snippets/rjsx-mode/React/cp
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: dcd12a23-82f9-4779-8847-1ff9a7fdaecc
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructProps
|
||||
# key: cp
|
||||
# --
|
||||
|
||||
const { $1 } = this.props
|
||||
8
snippets/rjsx-mode/React/cref
Normal file
8
snippets/rjsx-mode/React/cref
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 137d875c-953c-4180-bda6-0522b99af83a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: createRef
|
||||
# key: cref
|
||||
# --
|
||||
|
||||
this.${1:refName}Ref = React.createRef()
|
||||
8
snippets/rjsx-mode/React/cs
Normal file
8
snippets/rjsx-mode/React/cs
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 091603e8-70cf-42fa-89c0-4fb046aea976
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructState
|
||||
# key: cs
|
||||
# --
|
||||
|
||||
const { $1 } = this.state
|
||||
10
snippets/rjsx-mode/React/cwun
Normal file
10
snippets/rjsx-mode/React/cwun
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: f9e81a1f-356b-482d-9795-fc58fe00432d
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentWillUnmount
|
||||
# key: cwun
|
||||
# --
|
||||
|
||||
componentWillUnmount() {
|
||||
$0
|
||||
}
|
||||
10
snippets/rjsx-mode/React/est
Normal file
10
snippets/rjsx-mode/React/est
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: d1b4eeda-bb83-4aa0-ba21-d0d89671947f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: emptyState
|
||||
# key: est
|
||||
# --
|
||||
|
||||
state = {
|
||||
$1
|
||||
}
|
||||
8
snippets/rjsx-mode/React/fref
Normal file
8
snippets/rjsx-mode/React/fref
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 77cf7d01-d7db-40c5-856f-4fbd79a3f1d7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forwardRef
|
||||
# key: fref
|
||||
# --
|
||||
|
||||
const ref = React.createRef()
|
||||
10
snippets/rjsx-mode/React/gdsfp
Normal file
10
snippets/rjsx-mode/React/gdsfp
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 3eeec841-9d3b-4e5c-93af-f478ffacc3f1
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: getDerivedStateFromProps
|
||||
# key: gdsfp
|
||||
# --
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
$0
|
||||
}
|
||||
10
snippets/rjsx-mode/React/gsbu
Normal file
10
snippets/rjsx-mode/React/gsbu
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 6a682f76-d7e3-4983-bf11-735fa7143113
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: getSnapshotBeforeUpdate
|
||||
# key: gsbu
|
||||
# --
|
||||
|
||||
getSnapshotBeforeUpdate(prevProps, prevState) {
|
||||
$0
|
||||
}
|
||||
18
snippets/rjsx-mode/React/hoc
Normal file
18
snippets/rjsx-mode/React/hoc
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 0fccd0f9-2e0c-46e3-88e4-699b6adb680e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: hocComponent
|
||||
# key: hoc
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export default (WrappedComponent) => {
|
||||
const hocComponent = ({ ...props }) => <WrappedComponent {...props} />
|
||||
|
||||
hocComponent.propTypes = {
|
||||
}
|
||||
|
||||
return hocComponent
|
||||
}
|
||||
8
snippets/rjsx-mode/React/impt
Normal file
8
snippets/rjsx-mode/React/impt
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 33c4817a-b813-4326-8c37-383a6b731f0a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import PropTypes
|
||||
# key: impt
|
||||
# --
|
||||
|
||||
import PropTypes from 'prop-types'
|
||||
8
snippets/rjsx-mode/React/imr
Normal file
8
snippets/rjsx-mode/React/imr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: eab40eaf-3ddc-4994-9618-d575a82393fb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React
|
||||
# key: imr
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
8
snippets/rjsx-mode/React/imrc
Normal file
8
snippets/rjsx-mode/React/imrc
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 2e166e7c-41e6-4fb3-a6f5-2c1d9b1dacc2
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { Component }
|
||||
# key: imrc
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
9
snippets/rjsx-mode/React/imrcp
Normal file
9
snippets/rjsx-mode/React/imrcp
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 93c2e805-e6f9-4fc1-b664-3fd35d288574
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { Component } & PropTypes
|
||||
# key: imrcp
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
8
snippets/rjsx-mode/React/imrd
Normal file
8
snippets/rjsx-mode/React/imrd
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 733c4c97-18be-443d-a929-5a562dacf02b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import ReactDOM
|
||||
# key: imrd
|
||||
# --
|
||||
|
||||
import ReactDOM from 'react-dom'
|
||||
8
snippets/rjsx-mode/React/imrm
Normal file
8
snippets/rjsx-mode/React/imrm
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 5c0b476d-98e2-4696-abe2-fadd659dc136
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { memo }
|
||||
# key: imrm
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
||||
9
snippets/rjsx-mode/React/imrmp
Normal file
9
snippets/rjsx-mode/React/imrmp
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: c226a4f1-847a-4fe5-acb4-01489ff3883f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { memo } & PropTypes
|
||||
# key: imrmp
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
8
snippets/rjsx-mode/React/imrpc
Normal file
8
snippets/rjsx-mode/React/imrpc
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: b3a74dbd-aecf-4a5d-b2ae-5181ece57838
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { PureComponent }
|
||||
# key: imrpc
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
9
snippets/rjsx-mode/React/imrpcp
Normal file
9
snippets/rjsx-mode/React/imrpcp
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: b3d7bbf4-ad54-43c2-84d6-12448dc9f00b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { PureComponent } & PropTypes
|
||||
# key: imrpcp
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
8
snippets/rjsx-mode/React/imrr
Normal file
8
snippets/rjsx-mode/React/imrr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 7dfa38c5-1e83-4c4f-b9bb-eaa17fbaba58
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React Router
|
||||
# key: imrr
|
||||
# --
|
||||
|
||||
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
||||
8
snippets/rjsx-mode/React/props
Normal file
8
snippets/rjsx-mode/React/props
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ffd28ce2-1575-4e26-9e12-65c23d3f9ca2
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentProps
|
||||
# key: props
|
||||
# --
|
||||
|
||||
this.props.$0
|
||||
8
snippets/rjsx-mode/React/pta
Normal file
8
snippets/rjsx-mode/React/pta
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 128e90f1-5994-4011-92e6-9263fc186c71
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeArray
|
||||
# key: pta
|
||||
# --
|
||||
|
||||
PropTypes.array,
|
||||
8
snippets/rjsx-mode/React/ptany
Normal file
8
snippets/rjsx-mode/React/ptany
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 08932a85-31e3-4763-a210-7147d1c960e1
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeAny
|
||||
# key: ptany
|
||||
# --
|
||||
|
||||
PropTypes.any,
|
||||
8
snippets/rjsx-mode/React/ptao
Normal file
8
snippets/rjsx-mode/React/ptao
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a6c1a991-4c85-411c-b883-e1b74a6cc609
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeArrayOf
|
||||
# key: ptao
|
||||
# --
|
||||
|
||||
PropTypes.arrayOf($0),
|
||||
8
snippets/rjsx-mode/React/ptaor
Normal file
8
snippets/rjsx-mode/React/ptaor
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: f2e72fa4-efc0-4cb3-a03b-0a5f190a2f06
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeArrayOfRequired
|
||||
# key: ptaor
|
||||
# --
|
||||
|
||||
PropTypes.arrayOf($0).isRequired,
|
||||
8
snippets/rjsx-mode/React/ptar
Normal file
8
snippets/rjsx-mode/React/ptar
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a67e2217-054e-441c-90cb-514317ce7147
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeArrayRequired
|
||||
# key: ptar
|
||||
# --
|
||||
|
||||
PropTypes.array.isRequired,
|
||||
8
snippets/rjsx-mode/React/ptb
Normal file
8
snippets/rjsx-mode/React/ptb
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 92723ee5-aa37-4b1a-be15-c9a730961575
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeBool
|
||||
# key: ptb
|
||||
# --
|
||||
|
||||
PropTypes.bool,
|
||||
8
snippets/rjsx-mode/React/ptbr
Normal file
8
snippets/rjsx-mode/React/ptbr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: dbde6c9f-ee5e-4011-9408-a8893b9f3286
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeBoolRequired
|
||||
# key: ptbr
|
||||
# --
|
||||
|
||||
PropTypes.bool.isRequired,
|
||||
8
snippets/rjsx-mode/React/pte
Normal file
8
snippets/rjsx-mode/React/pte
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 56738701-7759-43b2-b3a5-f61077f00679
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeEnum
|
||||
# key: pte
|
||||
# --
|
||||
|
||||
PropTypes.oneOf(['$0']),
|
||||
8
snippets/rjsx-mode/React/ptel
Normal file
8
snippets/rjsx-mode/React/ptel
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 106b9955-0b26-4442-aebe-e69629a43856
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeElement
|
||||
# key: ptel
|
||||
# --
|
||||
|
||||
PropTypes.element,
|
||||
8
snippets/rjsx-mode/React/ptelr
Normal file
8
snippets/rjsx-mode/React/ptelr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: bf1ecbad-63d0-4f2d-a28f-f1f76d4da162
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeElementRequired
|
||||
# key: ptelr
|
||||
# --
|
||||
|
||||
PropTypes.element.isRequired,
|
||||
8
snippets/rjsx-mode/React/pter
Normal file
8
snippets/rjsx-mode/React/pter
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: d2971e16-ac74-4270-864e-9d771a0ba3d8
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeEnumRequired
|
||||
# key: pter
|
||||
# --
|
||||
|
||||
PropTypes.oneOf(['$0']).isRequired,
|
||||
10
snippets/rjsx-mode/React/ptet
Normal file
10
snippets/rjsx-mode/React/ptet
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: fffe178e-0de7-4cd0-b3a0-b9d6679738d7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeOneOfType
|
||||
# key: ptet
|
||||
# --
|
||||
|
||||
PropTypes.oneOfType([
|
||||
$0
|
||||
]),
|
||||
10
snippets/rjsx-mode/React/ptetr
Normal file
10
snippets/rjsx-mode/React/ptetr
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 2e95e787-9b25-4618-a16f-7d290a80ef17
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeOneOfTypeRequired
|
||||
# key: ptetr
|
||||
# --
|
||||
|
||||
PropTypes.oneOfType([
|
||||
$0
|
||||
]).isRequired,
|
||||
8
snippets/rjsx-mode/React/ptf
Normal file
8
snippets/rjsx-mode/React/ptf
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: c1ba108b-8b55-4c1f-bc6b-04f3d0aa489f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeFunc
|
||||
# key: ptf
|
||||
# --
|
||||
|
||||
PropTypes.func,
|
||||
8
snippets/rjsx-mode/React/ptfr
Normal file
8
snippets/rjsx-mode/React/ptfr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 5f377808-588a-48a1-8da3-fcabfcea78e6
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeFuncRequired
|
||||
# key: ptfr
|
||||
# --
|
||||
|
||||
PropTypes.func.isRequired,
|
||||
8
snippets/rjsx-mode/React/pti
Normal file
8
snippets/rjsx-mode/React/pti
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 2b76dd2b-5065-47b9-a8f9-9c25c49327c5
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeInstanceOf
|
||||
# key: pti
|
||||
# --
|
||||
|
||||
PropTypes.instanceOf($0),
|
||||
8
snippets/rjsx-mode/React/ptir
Normal file
8
snippets/rjsx-mode/React/ptir
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 7fcf75fb-2d69-4d9d-af72-9667d13831d8
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeInstanceOfRequired
|
||||
# key: ptir
|
||||
# --
|
||||
|
||||
PropTypes.instanceOf($0).isRequired,
|
||||
8
snippets/rjsx-mode/React/ptn
Normal file
8
snippets/rjsx-mode/React/ptn
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 6c2482e1-a8c3-4b2a-a3b2-3e4eedabd3e4
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeNumber
|
||||
# key: ptn
|
||||
# --
|
||||
|
||||
PropTypes.number,
|
||||
8
snippets/rjsx-mode/React/ptnd
Normal file
8
snippets/rjsx-mode/React/ptnd
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 9902d633-c968-4215-835a-3e229678ea02
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeNode
|
||||
# key: ptnd
|
||||
# --
|
||||
|
||||
PropTypes.node,
|
||||
8
snippets/rjsx-mode/React/ptndr
Normal file
8
snippets/rjsx-mode/React/ptndr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 2d93109e-3916-42b5-afda-692d0ea2e784
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeNodeRequired
|
||||
# key: ptndr
|
||||
# --
|
||||
|
||||
PropTypes.node.isRequired,
|
||||
8
snippets/rjsx-mode/React/ptnr
Normal file
8
snippets/rjsx-mode/React/ptnr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 8fdab8f9-bce1-4f0f-8b9a-3d2f3d674b39
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeNumberRequired
|
||||
# key: ptnr
|
||||
# --
|
||||
|
||||
PropTypes.number.isRequired,
|
||||
8
snippets/rjsx-mode/React/pto
Normal file
8
snippets/rjsx-mode/React/pto
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ee3e2d3d-7d9d-42e8-a05f-ca30b04a7507
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeObject
|
||||
# key: pto
|
||||
# --
|
||||
|
||||
PropTypes.object,
|
||||
8
snippets/rjsx-mode/React/ptoo
Normal file
8
snippets/rjsx-mode/React/ptoo
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 9681a478-42a2-4253-b652-ce92f5be6432
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeObjectOf
|
||||
# key: ptoo
|
||||
# --
|
||||
|
||||
PropTypes.objectOf($0),
|
||||
8
snippets/rjsx-mode/React/ptoor
Normal file
8
snippets/rjsx-mode/React/ptoor
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 6179536d-f392-4fe6-9c01-e1d59e7c0cc4
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeObjectOfRequired
|
||||
# key: ptoor
|
||||
# --
|
||||
|
||||
PropTypes.objectOf($0).isRequired,
|
||||
8
snippets/rjsx-mode/React/ptor
Normal file
8
snippets/rjsx-mode/React/ptor
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: b0e07d72-3b54-4c30-a379-015b9537cf33
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeObjectRequired
|
||||
# key: ptor
|
||||
# --
|
||||
|
||||
PropTypes.object.isRequired,
|
||||
8
snippets/rjsx-mode/React/pts
Normal file
8
snippets/rjsx-mode/React/pts
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 00414dbf-83ff-4777-949f-79e94d32f661
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeString
|
||||
# key: pts
|
||||
# --
|
||||
|
||||
PropTypes.string,
|
||||
10
snippets/rjsx-mode/React/ptsh
Normal file
10
snippets/rjsx-mode/React/ptsh
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: d370d2c0-4093-4186-9102-070b1077ef1e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeShape
|
||||
# key: ptsh
|
||||
# --
|
||||
|
||||
PropTypes.shape({
|
||||
$0
|
||||
}),
|
||||
10
snippets/rjsx-mode/React/ptshr
Normal file
10
snippets/rjsx-mode/React/ptshr
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 51708c90-2ba2-4ed4-bda9-e99e71ec3eeb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeShapeRequired
|
||||
# key: ptshr
|
||||
# --
|
||||
|
||||
PropTypes.shape({
|
||||
$0
|
||||
}).isRequired,
|
||||
8
snippets/rjsx-mode/React/ptsr
Normal file
8
snippets/rjsx-mode/React/ptsr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: b81ebfbd-fea2-4357-94c2-ad8fdd0efb4d
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propTypeStringRequired
|
||||
# key: ptsr
|
||||
# --
|
||||
|
||||
PropTypes.string.isRequired,
|
||||
10
snippets/rjsx-mode/React/ptypes
Normal file
10
snippets/rjsx-mode/React/ptypes
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 287a1b5e-57e6-4e00-b2af-24dd61bf6d8c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: staticPropTpyes
|
||||
# key: ptypes
|
||||
# --
|
||||
|
||||
static propTypes = {
|
||||
$0
|
||||
}
|
||||
18
snippets/rjsx-mode/React/rafc
Normal file
18
snippets/rjsx-mode/React/rafc
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 7c78fcf4-0cc0-4590-9abe-a9fc7b2a24e2
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactArrowFunctionComponent
|
||||
# key: rafc
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
|
||||
const ${1:`(yas-jsx-get-class-name-by-file-name)`} = (props) => {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default $1
|
||||
18
snippets/rjsx-mode/React/rafce
Normal file
18
snippets/rjsx-mode/React/rafce
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 65be124a-71d0-4fd9-975a-08d6ec6f9c58
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactArrowFunctionExportComponent
|
||||
# key: rafce
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
|
||||
const ${1:`(yas-jsx-get-class-name-by-file-name)`} = (props) => {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default $1
|
||||
23
snippets/rjsx-mode/React/rafcp
Normal file
23
snippets/rjsx-mode/React/rafcp
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a85f3fea-065d-499b-a297-b6e3f516c2d7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactArrowFunctionComponentWithPropTypes
|
||||
# key: rafcp
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
const ${1:`(yas-jsx-get-class-name-by-file-name)`} = (props) => {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
$1.propTypes = {
|
||||
|
||||
}
|
||||
|
||||
export default $1
|
||||
18
snippets/rjsx-mode/React/rcc
Normal file
18
snippets/rjsx-mode/React/rcc
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 5fa22440-fa5b-4f3e-98d5-9abe8c68fd5b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassCompoment
|
||||
# key: rcc
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
23
snippets/rjsx-mode/React/rccp
Normal file
23
snippets/rjsx-mode/React/rccp
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: f8a0e704-88a4-4c72-8b9e-44fcf0290ae7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassCompomentPropTypes
|
||||
# key: rccp
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
static propTypes = {
|
||||
${2:prop}: ${3:PropTypes}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
20
snippets/rjsx-mode/React/rce
Normal file
20
snippets/rjsx-mode/React/rce
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 43afee80-d7ef-41f5-8aa5-2571c4332da0
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassExportComponent
|
||||
# key: rce
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default $1
|
||||
25
snippets/rjsx-mode/React/rcep
Normal file
25
snippets/rjsx-mode/React/rcep
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 5792fd46-6659-42c4-9c71-d7ca7d72a2a0
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassExportComponentWithPropTypes
|
||||
# key: rcep
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
static propTypes = {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default $1
|
||||
14
snippets/rjsx-mode/React/rconst
Normal file
14
snippets/rjsx-mode/React/rconst
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 01abffb6-2b92-423d-850b-51ee5fdf4117
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: classConstructor
|
||||
# key: rconst
|
||||
# --
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
$0
|
||||
}
|
||||
}
|
||||
8
snippets/rjsx-mode/React/rcontext
Normal file
8
snippets/rjsx-mode/React/rcontext
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: f33474db-1dd4-402b-852a-2c486d464213
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: createContext
|
||||
# key: rcontext
|
||||
# --
|
||||
|
||||
const ${1:contextName} = React.createContext()
|
||||
14
snippets/rjsx-mode/React/ren
Normal file
14
snippets/rjsx-mode/React/ren
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: bfc91d09-863d-4e5d-96bf-afbd234f7ca8
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentRender
|
||||
# key: ren
|
||||
# --
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
14
snippets/rjsx-mode/React/rmc
Normal file
14
snippets/rjsx-mode/React/rmc
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 6847343b-1efa-4db0-9b9a-2c9aaa4217c7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactFunctionMemoComponent
|
||||
# key: rmc
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
||||
|
||||
export default memo((props) => (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
))
|
||||
21
snippets/rjsx-mode/React/rmcp
Normal file
21
snippets/rjsx-mode/React/rmcp
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ba569173-16e1-4d9d-9205-96dc0832455f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactFunctionMemoComponentWithPropTypes
|
||||
# key: rmcp
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
const ${1:`(yas-jsx-get-class-name-by-file-name)`} = memo((props) => (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
))
|
||||
|
||||
$1.propTypes = {
|
||||
|
||||
}
|
||||
|
||||
export default $1
|
||||
18
snippets/rjsx-mode/React/rpc
Normal file
18
snippets/rjsx-mode/React/rpc
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 58802667-d355-45e8-a000-c2e5d9677b97
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassPureComponent
|
||||
# key: rpc
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
20
snippets/rjsx-mode/React/rpce
Normal file
20
snippets/rjsx-mode/React/rpce
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 295423f2-7029-42d3-ba82-8c5edfda37ce
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassExportPureComponent
|
||||
# key: rpce
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default $1
|
||||
23
snippets/rjsx-mode/React/rpcp
Normal file
23
snippets/rjsx-mode/React/rpcp
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 54fc179d-98f0-44b8-bd39-a66ac67aaf38
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassPureComponentWithPropTypes
|
||||
# key: rpcp
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
|
||||
static propTypes = {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
10
snippets/rjsx-mode/React/scu
Normal file
10
snippets/rjsx-mode/React/scu
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 0f6de3c7-5374-445d-a82e-d01364b53f04
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: shouldComponentUpdate
|
||||
# key: scu
|
||||
# --
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
$0
|
||||
}
|
||||
8
snippets/rjsx-mode/React/ssf
Normal file
8
snippets/rjsx-mode/React/ssf
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 0f0e900a-8cf8-4fc6-a03d-75e73bb21f48
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentSetStateFunc
|
||||
# key: ssf
|
||||
# --
|
||||
|
||||
this.setState((state, props) => { return { $0 }})
|
||||
8
snippets/rjsx-mode/React/sst
Normal file
8
snippets/rjsx-mode/React/sst
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 28f6e070-6384-471f-95bf-24fbb77d4d51
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentSetStateObject
|
||||
# key: sst
|
||||
# --
|
||||
|
||||
this.setState({$0})
|
||||
8
snippets/rjsx-mode/React/state
Normal file
8
snippets/rjsx-mode/React/state
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 2830720f-93e5-4c01-9624-c4ba068eecce
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentState
|
||||
# key: state
|
||||
# --
|
||||
|
||||
this.state.$0
|
||||
29
snippets/rjsx-mode/Redux/hocredux
Normal file
29
snippets/rjsx-mode/Redux/hocredux
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 68de6229-17f5-4bd6-83ef-feaa3a1ccb31
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: hocComponentWithRedux
|
||||
# key: hocredux
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
export const ${1:hocComponentName} = (WrappedComponent) => {
|
||||
const hocComponent = (props) => <WrappedComponent {...props} />
|
||||
|
||||
hocComponent.propTypes = {
|
||||
}
|
||||
|
||||
return hocComponent
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(${1:hocComponentName}(WrapperComponent))
|
||||
34
snippets/rjsx-mode/Redux/rcredux
Normal file
34
snippets/rjsx-mode/Redux/rcredux
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: c948b832-8ff1-41b2-a256-ce629dcd4dbe
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactClassCompomentRedux
|
||||
# key: rcredux
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
static propTypes = {
|
||||
${2:prop}: ${3:PropTypes}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
$0
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)($1)
|
||||
8
snippets/rjsx-mode/Redux/redux
Normal file
8
snippets/rjsx-mode/Redux/redux
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: ebcbdf19-4ba9-404f-ab66-eb9b992d7126
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import redux statement
|
||||
# key: redux
|
||||
# --
|
||||
|
||||
import { connect } from 'react-redux'
|
||||
20
snippets/rjsx-mode/Redux/reduxmap
Normal file
20
snippets/rjsx-mode/Redux/reduxmap
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 32f4d017-7d51-4d41-a954-91e2eaf493c5
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: mappingToProps
|
||||
# key: reduxmap
|
||||
# --
|
||||
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
const mergeProps = (stateProps, dispatchProps, ownProps) => ({
|
||||
...ownProps,
|
||||
...dispatchProps,
|
||||
...stateProps,
|
||||
})
|
||||
35
snippets/rjsx-mode/Redux/rncredux
Normal file
35
snippets/rjsx-mode/Redux/rncredux
Normal file
@@ -0,0 +1,35 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 73a39297-05ec-45c0-9a05-9b3e5653c477
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeClassComponentRedux
|
||||
# key: rncredux
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { View, Text } from 'react-native'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
|
||||
static propTypes = {
|
||||
${2:prop}: ${3:PropTypes}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text>${2:textInComponent}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)($1)
|
||||
11
snippets/rjsx-mode/Redux/rxaction
Normal file
11
snippets/rjsx-mode/Redux/rxaction
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 9a5dfef3-2b52-4c8e-bad1-3493599e10d9
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reduxAction
|
||||
# key: rxaction
|
||||
# --
|
||||
|
||||
export const ${1:actionName} = (payload) => ({
|
||||
type: ${1:$((yas-snake-case yas-text))},
|
||||
payload
|
||||
})
|
||||
8
snippets/rjsx-mode/Redux/rxconst
Normal file
8
snippets/rjsx-mode/Redux/rxconst
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a274faf6-2964-4a22-adf7-1715d3b4a153
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reduxConst
|
||||
# key: rxconst
|
||||
# --
|
||||
|
||||
export const ${1:constantName} = '${1:constantName}'
|
||||
20
snippets/rjsx-mode/Redux/rxreducer
Normal file
20
snippets/rjsx-mode/Redux/rxreducer
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a7bb3ea0-bf96-401b-851e-a63b254f42ba
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reduxReducer
|
||||
# key: rxreducer
|
||||
# --
|
||||
|
||||
const initialState = {
|
||||
|
||||
}
|
||||
|
||||
export default (state = initialState, { type, payload }) => {
|
||||
switch (type) {
|
||||
case ${1:typeName}:
|
||||
return { ...state, ...payload }
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
10
snippets/rjsx-mode/Redux/rxselect
Normal file
10
snippets/rjsx-mode/Redux/rxselect
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: a654de53-26a1-4694-9da7-cc4b906d50fa
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reduxSelector
|
||||
# key: rxselect
|
||||
# --
|
||||
|
||||
import { createSelector } from 'reselect'
|
||||
|
||||
export const ${1:selectorName} = state => state.${2:selector}
|
||||
Reference in New Issue
Block a user