Skip to content

Instantly share code, notes, and snippets.

@lfuelling
Last active February 11, 2024 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfuelling/5d98a7770a0781471180c01c287ad487 to your computer and use it in GitHub Desktop.
Save lfuelling/5d98a7770a0781471180c01c287ad487 to your computer and use it in GitHub Desktop.
Webstorm / IntelliJ Typescript React Arrow Function Template

Webstorm / IntelliJ Typescript React Arrow Function Template

This is a IntelliJ/WebStorm live template that can be used to easily create a new arrow function component.

How to use

  1. Go to the WebStorm/IntelliJ settings
  2. Open the Live Template editor
  3. Add a new template to the "React" section
  4. Add the contents of content.tsx to the content field
  5. Add the TM_FILENAME_BASE variable using this expression: capitalize(camelCase(fileNameWithoutExtension()))
  6. Add the TypeScript > Top Level Statement context
  7. Use any abbreviation you like, I usually use rfc
import * as React from 'react';
import { FunctionComponent } from 'react';
type Props = Record<string, never>;
const $TM_FILENAME_BASE$: FunctionComponent<Props> = () => {
return (
<div>
$END$
</div>
);
}
export default $TM_FILENAME_BASE$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment