Does anybody knows what's the shortcut for React functional components snippet in Visual Studio? I have the ES7 React/Redux/GraphQL/React-Native snippets extension enabled in the editor.
If you wish to create React functional component snippet in VS Code follow these steps.
File - Preferences - Configure User SnippetsNew Global Snippets file and type <any-name> you want and hit enter<any-name>.code-snippetprefix will be your component trigger{
"React Functional Component": {
"prefix": "rfc",
"body": [
"import React from \"react\"",
"",
"const ${1:name} = (props) => {",
" return (",
" <div>",
" $2",
" </div>",
" )",
"};",
"",
"export default ${1:name};",
""
],
"description": "React Functional Component"
}
}
rfc and hit enter.I used the rafce live template for new components.
This creates code like:
import React from 'react';
const MyComponent = () => {
return (
<div>
</div>
);
};
export default MyComponent;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With