diff --git a/snippets/rjsx-mode/React/rpce b/snippets/rjsx-mode/React/rpce
index 08f5598..a1a2c32 100644
--- a/snippets/rjsx-mode/React/rpce
+++ b/snippets/rjsx-mode/React/rpce
@@ -7,7 +7,7 @@
import React, { PureComponent } from 'react'
-export class ${1:${TM_FILENAME_BASE}} extends PureComponent {
+export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
render() {
return (
@@ -17,4 +17,4 @@ export class ${1:${TM_FILENAME_BASE}} extends PureComponent {
}
}
-export default ${1:$TM_FILENAME_BASE}
\ No newline at end of file
+export default $1
\ No newline at end of file
diff --git a/snippets/rjsx-mode/React/rpcp b/snippets/rjsx-mode/React/rpcp
index d74a310..d9fe8f5 100644
--- a/snippets/rjsx-mode/React/rpcp
+++ b/snippets/rjsx-mode/React/rpcp
@@ -8,7 +8,7 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
-export default class ${1:${TM_FILENAME_BASE}} extends PureComponent {
+export default class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends PureComponent {
static propTypes = {
}
diff --git a/snippets/rjsx-mode/React/scu b/snippets/rjsx-mode/React/scu
index 19062dc..314b079 100644
--- a/snippets/rjsx-mode/React/scu
+++ b/snippets/rjsx-mode/React/scu
@@ -5,6 +5,6 @@
# key: scu
# --
-shouldComponentUpdate = (nextProps, nextState) => {
+shouldComponentUpdate(nextProps, nextState) {
$0
}
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/hocredux b/snippets/rjsx-mode/Redux/hocredux
index 41dfd35..b1e455a 100644
--- a/snippets/rjsx-mode/Redux/hocredux
+++ b/snippets/rjsx-mode/Redux/hocredux
@@ -9,16 +9,8 @@ import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
-export const mapStateToProps = state => ({
-
-})
-
-export const mapDispatchToProps = {
-
-}
-
export const ${1:hocComponentName} = (WrappedComponent) => {
- const hocComponent = ({ ...props }) =>
+ const hocComponent = (props) =>
hocComponent.propTypes = {
}
@@ -26,4 +18,12 @@ export const ${1:hocComponentName} = (WrappedComponent) => {
return hocComponent
}
+const mapStateToProps = (state, ownProps) => ({
+
+})
+
+const mapDispatchToProps = (dispatch, ownProps) => ({
+
+})
+
export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(${1:hocComponentName}(WrapperComponent))
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/rcredux b/snippets/rjsx-mode/Redux/rcredux
index 497d5cb..903dd92 100644
--- a/snippets/rjsx-mode/Redux/rcredux
+++ b/snippets/rjsx-mode/Redux/rcredux
@@ -9,7 +9,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
-export class ${1:${TM_FILENAME_BASE}} extends Component {
+export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
static propTypes = {
${2:prop}: ${3:PropTypes}
}
@@ -23,12 +23,12 @@ export class ${1:${TM_FILENAME_BASE}} extends Component {
}
}
-const mapStateToProps = (state) => ({
+const mapStateToProps = (state, ownProps) => ({
})
-const mapDispatchToProps = {
+const mapDispatchToProps = (dispatch, ownProps) => ({
-}
+})
-export default connect(mapStateToProps, mapDispatchToProps)(${1:${TM_FILENAME_BASE}})
\ No newline at end of file
+export default connect(mapStateToProps, mapDispatchToProps)($1)
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/reduxmap b/snippets/rjsx-mode/Redux/reduxmap
index f9146f9..199bcdb 100644
--- a/snippets/rjsx-mode/Redux/reduxmap
+++ b/snippets/rjsx-mode/Redux/reduxmap
@@ -5,10 +5,16 @@
# key: reduxmap
# --
-const mapStateToProps = (state) => ({
- ${1}
+const mapStateToProps = (state, ownProps) => ({
+
})
-const mapDispatchToProps = {
-
-}
\ No newline at end of file
+const mapDispatchToProps = (dispatch, ownProps) => ({
+
+})
+
+const mergeProps = (stateProps, dispatchProps, ownProps) => ({
+ ...ownProps,
+ ...dispatchProps,
+ ...stateProps,
+})
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/rncredux b/snippets/rjsx-mode/Redux/rncredux
index 78dedf3..66fea00 100644
--- a/snippets/rjsx-mode/Redux/rncredux
+++ b/snippets/rjsx-mode/Redux/rncredux
@@ -10,7 +10,7 @@ import { View, Text } from 'react-native'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
-export class ${1:${TM_FILENAME_BASE}} extends Component {
+export class ${1:`(yas-jsx-get-class-name-by-file-name)`} extends Component {
static propTypes = {
${2:prop}: ${3:PropTypes}
}
@@ -18,18 +18,18 @@ export class ${1:${TM_FILENAME_BASE}} extends Component {
render() {
return (
- ${2:textInComponent}
+ ${2:textInComponent}
)
}
}
-const mapStateToProps = (state) => ({
-
+const mapStateToProps = (state, ownProps) => ({
+
})
-const mapDispatchToProps = {
-
-}
+const mapDispatchToProps = (dispatch, ownProps) => ({
-export default connect(mapStateToProps, mapDispatchToProps)(${1:${TM_FILENAME_BASE}})
\ No newline at end of file
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)($1)
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/rxaction b/snippets/rjsx-mode/Redux/rxaction
index a1994bb..4a0eef3 100644
--- a/snippets/rjsx-mode/Redux/rxaction
+++ b/snippets/rjsx-mode/Redux/rxaction
@@ -6,6 +6,6 @@
# --
export const ${1:actionName} = (payload) => ({
- type: ${3:type},
+ type: ${1:$((upcase (s-snake-case yas-text)))},
payload
})
\ No newline at end of file
diff --git a/snippets/rjsx-mode/Redux/rxreducer b/snippets/rjsx-mode/Redux/rxreducer
index fe7e476..951f5e4 100644
--- a/snippets/rjsx-mode/Redux/rxreducer
+++ b/snippets/rjsx-mode/Redux/rxreducer
@@ -11,11 +11,10 @@ const initialState = {
export default (state = initialState, { type, payload }) => {
switch (type) {
+ case ${1:typeName}:
+ return { ...state, ...payload }
- case ${1:typeName}:
- return { ...state, ...payload }
-
- default:
- return state
+ default:
+ return state
}
}
\ No newline at end of file
diff --git a/yasnippet-snippets.el b/yasnippet-snippets.el
index dc689e7..cdce16e 100644
--- a/yasnippet-snippets.el
+++ b/yasnippet-snippets.el
@@ -5,7 +5,7 @@
;; Author: Andrea Crotti
;; Keywords: snippets
;; Version: 0.2
-;; Package-Requires: ((yasnippet "0.8.0"))
+;; Package-Requires: ((yasnippet "0.8.0") (s "1.12.0"))
;; Keywords: convenience, snippets
;;; Commentary: