Does anybody knows what the shortcut is for React functional components snippet in WebStorm?
So far I only found shortcut for class components.
WebStorm provides code completion for React APIs and JSX in JavaScript code. Code completion works for React methods, React-specific attributes, HTML tags and component names, React events, component properties, and so on. Learn more from the React official website.
React code snippetsPress Ctrl+J and choose the relevant snippet.
Please try rsf
- it creates a code like
import React from 'react';
function Func(props) {
return (<div></div>);
}
export default Func;
I use the rsc
live template a lot for new components.
This creates code like:
import React from 'react';
const MyComponent = () => {
return (
<div>
</div>
);
};
export default MyComponent;
Apart from that I created my own live template in the JavaScript category for creating arrow functions to save even more time, which creates code like:
const myFunction = () => {
};
Just add a new Live Template under the JavaScript category with this template text:
const $1$ = () => {
$END$
};
And make sure to set applicable in
to JavaScript and TypeScript
and select the checkboxes for:
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