Skip to content

Instantly share code, notes, and snippets.

@ChrisLowe-Takor
Last active December 7, 2020 08:51
Show Gist options
  • Save ChrisLowe-Takor/5fda225cdebdf1677e78640397f34632 to your computer and use it in GitHub Desktop.
Save ChrisLowe-Takor/5fda225cdebdf1677e78640397f34632 to your computer and use it in GitHub Desktop.
React connected component visual code snippet
"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