From 87204d9b186c97bbf31b5f4d1d880d2418a577de Mon Sep 17 00:00:00 2001 From: Ryosuke <37885061+whoisryosuke@users.noreply.github.com> Date: Mon, 13 Aug 2018 10:54:56 -0700 Subject: [PATCH] :bug: Fixed rfcp by defining component name Can't apply proptypes outside of a class/function without using a named function. This change defines the component function by the filename, and exports it separately (since directly exported const aren't supported). --- snippets/snippets.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snippets/snippets.json b/snippets/snippets.json index 7678993..75ca3a8 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -315,7 +315,7 @@ "import React from 'react'", "import PropTypes from 'prop-types'", "", - "export default () => {", + "const ${1:${TM_FILENAME_BASE}} = () => {", " return (", "
", " $0", @@ -326,6 +326,9 @@ "${1:${TM_FILENAME_BASE}}.propTypes = {", "", "}", + "", + "export default ${1:${TM_FILENAME_BASE}}", + "", "" ], "description": "Creates a React Functional Component with ES7 module system with PropTypes"