Skip to content

Instantly share code, notes, and snippets.

@migsan
Created March 12, 2020 20:46
Show Gist options
  • Save migsan/74e53d56c0ad77a4972b2b51bffe5ed9 to your computer and use it in GitHub Desktop.
Save migsan/74e53d56c0ad77a4972b2b51bffe5ed9 to your computer and use it in GitHub Desktop.
VSCode custom snippet for a memo component
{
"Functional Memo Component": {
"prefix": "tsxmemo",
"body": [
"import React from 'react'",
"import { styled } from '~/styles'",
"",
"// Types ----------",
"",
"interface ComponentProps {}",
"",
"// Component ------",
"",
"const $0Component: React.FC<ComponentProps> = props => {",
"\treturn (",
"\t\t<>",
"\t\t\t<StyledElement>Example text</StyledElement>",
"\t\t</>",
"\t)",
"}",
"",
"// Styles ---------",
"",
"const StyledElement = styled.div(",
"\t({ theme }) => `",
"\t\tfont-family: ${theme.fontFaces.NHK.bold};",
"\t`",
")",
"",
"// Export ---------",
"",
"export default React.memo(Component)",
""
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment