/react-snippets

Collection of react snippets that I use, supporting both JavaScript & TypeScript.

MIT LicenseMIT

React Snippets

VS Code JavaScript TypeScript

Collection of react snippets I use, supporting both JavaScript and TypeScript. I use these over the many pre-existing extensions because those generally clog up VS Code with tons of snippets i would never use.

How To Add Snippets

  • Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  • Type "Configure User Snippets" and select it
  • Choose "New Global Snippets file..."
  • Name your snippets file whatever you'd like
  • Copy and paste the snippets into the newly created file

✂️ Snippets

Alias Purpose
imr Import React statement
rc React Function Component with export const
rct Same as above but with a props interface
ush useState Hook
efh useEffect Hook
ech useCallback Hook
emh useMemo Hook
urh useRef Hook
tern Ternary Operator Condition
ushLoad Generic loading state hook
uihh useImperativeHandle hook
utt useTranslation hook with t function

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.