From e9a61b47b07ed845fe065824f60bd324f97e61f6 Mon Sep 17 00:00:00 2001 From: timcluyts Date: Mon, 24 Dec 2018 14:35:35 +0100 Subject: [PATCH] Add memo to snippets --- snippets/snippets.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/snippets/snippets.json b/snippets/snippets.json index b3a8641..5d979c3 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -49,6 +49,16 @@ "body": "import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst ${1:${TM_FILENAME_BASE}} = props => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n\n${1:${TM_FILENAME_BASE}}.propTypes = {\n\t$0\n};\n\nexport default ${1:${TM_FILENAME_BASE}};", "description": "Creates a stateless React component with PropTypes and ES6 module system" }, + "reactMemo": { + "prefix": "rm", + "body": "import React, { memo } from 'react';\n\nconst ${1:${TM_FILENAME_BASE}} = memo(() => {\n\treturn (\n\t\t
\n\t\t\t$0\n\t\t
\n\t);\n});\n\nexport default ${1:${TM_FILENAME_BASE}};", + "description": "Creates a stateless React component without PropTypes and ES6 module system" + }, + "reactMemoProps": { + "prefix": "rmp", + "body": "import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\n\nconst ${1:${TM_FILENAME_BASE}} = memo((props) => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n});\n\n${1:${TM_FILENAME_BASE}}.propTypes = {\n\t$0\n};\n\nexport default ${1:${TM_FILENAME_BASE}};", + "description": "Creates a stateless React component with PropTypes and ES6 module system" + }, "flowStatelessComponent": { "prefix": "fsc", "body": "// @flow \nimport * as React from 'react';\ntype Props = {\n\t$0\n};\nexport const ${1:${TM_FILENAME_BASE}} = (props: Props) => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};", @@ -370,4 +380,4 @@ "body": "function mapDispatchToProps(dispatch) {\n\treturn {\n\t}\n\n}", "description": "Adds the redux mapDispatchToProps function" } -} \ No newline at end of file +}