Last active
December 7, 2020 08:51
-
-
Save ChrisLowe-Takor/5fda225cdebdf1677e78640397f34632 to your computer and use it in GitHub Desktop.
React connected component visual code snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
"React Connected Component": { | |
"prefix": "rcc", | |
"body": [ | |
"import React, { useState, useEffect } from 'react';", | |
"import styled from 'styled-components'", | |
"import { createStructuredSelector } from 'reselect';", | |
"", | |
"", | |
"const connect = require('react-redux').connect", | |
"", | |
"interface $1Props {", | |
"", | |
"}", | |
"", | |
"const $1 = (props: $1Props) => {", | |
" return (", | |
" <React.Fragment>", | |
"", | |
" </React.Fragment>", | |
" )", | |
"};", | |
"", | |
"function mapStateToProps() {", | |
" return createStructuredSelector({", | |
"", | |
" })", | |
"};", | |
"", | |
"function mapDispatchToProps(dispatch: any) {", | |
" return {", | |
"", | |
" }", | |
"};", | |
"", | |
"export default connect(mapStateToProps, mapDispatchToProps)($1);" | |
], | |
"description": "React Connected Component" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment