Skip to content

Commit f7ee493

Browse files
valtismDamian Sznajder
authored and
Damian Sznajder
committed
Add rfcredux and rfreduxp
Added equivelant redux components but for function components.
1 parent 47af826 commit f7ee493

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,53 @@ const mapDispatchToProps = {}
432432
export default connect(mapStateToProps, mapDispatchToProps)(FileName)
433433
```
434434

435+
### `rfcredux`
436+
437+
```javascript
438+
import React, { Component } from 'react'
439+
import { connect } from 'react-redux'
440+
441+
export const FileName = () => {
442+
return (
443+
<div>
444+
$4
445+
</div>
446+
)
447+
}
448+
449+
const mapStateToProps = state => ({})
450+
451+
const mapDispatchToProps = {}
452+
453+
export default connect(mapStateToProps, mapDispatchToProps)(FileName)
454+
```
455+
456+
### `rfreduxp`
457+
458+
```javascript
459+
import React, { Component } from 'react'
460+
import PropTypes from 'prop-types'
461+
import { connect } from 'react-redux'
462+
463+
export const FileName = () => {
464+
return (
465+
<div>
466+
$4
467+
</div>
468+
)
469+
}
470+
471+
FileName.propTypes = {
472+
$2: $3
473+
}
474+
475+
const mapStateToProps = state => ({})
476+
477+
const mapDispatchToProps = {}
478+
479+
export default connect(mapStateToProps, mapDispatchToProps)(FileName)
480+
```
481+
435482
### `reduxmap`
436483

437484
```javascript

snippets/snippets.json

+58
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,64 @@
648648
""
649649
],
650650
"description": "Creates a React component class with PropTypes with connected redux and ES7 module system"
651+
},"reactFunctionalCompomentRedux": {
652+
"prefix": "rfcredux",
653+
"body": [
654+
"import React, { Component } from 'react'",
655+
"import { connect } from 'react-redux'",
656+
"",
657+
"export const ${1:${TM_FILENAME_BASE}} = () => {",
658+
"\treturn (",
659+
"\t\t<div>",
660+
"\t\t\t$0",
661+
"\t\t</div>",
662+
"\t)",
663+
"}",
664+
"",
665+
"const mapStateToProps = (state) => ({",
666+
"\t",
667+
"})",
668+
"",
669+
"const mapDispatchToProps = {",
670+
"\t",
671+
"}",
672+
"",
673+
"export default connect(mapStateToProps, mapDispatchToProps)(${1:${TM_FILENAME_BASE}})",
674+
""
675+
],
676+
"description": "Creates a React functional component with connected redux and ES7 module system"
677+
},
678+
"reactFunctionalCompomentReduxPropTypes": {
679+
"prefix": "rfcreduxp",
680+
"body": [
681+
"import React, { Component } from 'react'",
682+
"import PropTypes from 'prop-types'",
683+
"import { connect } from 'react-redux'",
684+
"",
685+
"export const ${1:${TM_FILENAME_BASE}} = () => {",
686+
"\treturn (",
687+
"\t\t<div>",
688+
"\t\t\t$0",
689+
"\t\t</div>",
690+
"\t)",
691+
"}",
692+
"",
693+
"${1:${TM_FILENAME_BASE}}.propTypes = {",
694+
"\t${2:prop}: ${3:PropTypes}",
695+
"}",
696+
"",
697+
"const mapStateToProps = (state) => ({",
698+
"\t",
699+
"})",
700+
"",
701+
"const mapDispatchToProps = {",
702+
"\t",
703+
"}",
704+
"",
705+
"export default connect(mapStateToProps, mapDispatchToProps)(${1:${TM_FILENAME_BASE}})",
706+
""
707+
],
708+
"description": "Creates a React functional component with PropTypes with connected redux and ES7 module system"
651709
},
652710
"mappingToProps": {
653711
"prefix": "reduxmap",

0 commit comments

Comments
 (0)