Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Useful React SnippetsNew to Visual Studio Code? Get it now.
Useful React Snippets

Useful React Snippets

igorming

|
60,770 installs
| (6) | Free
Snippets for VSCode to help you to code faster! Either you're using Javascript or Typescript for writing it.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Version Install Ratings

VS Code React Snippets

Snippets in JSON format specifically to be used on VS Code Editor.

Easy shortcuts to help and expedite your code development.

NOTE: Version 2.x comes with some changes for typescript files!

Following below the available snippets

Command Description
clog A simple console.log();
cwarn A simple console.warn();
cerr A simple console.error();
scomp Stateless component creation
comp React component creation
rncomp React Native component creation
impvar Import an exported variable
imp Import a default exported variable from an absolute library
impdir Import a default exported variable from a directory
impvardir Import a exported variable from a directory
action Simple action creation (returns an object)
thunk Thunk action creation (returns a function)
reducer Simple reducer creation
duck An entire module following the ducks pattern
cdm Lifecycle: ComponentDidMount
cdu Lifecycle: ComponentDidUpdate
cwun Lifecycle: ComponentWillUnmount
gdsfp Lifecycle: static getDerivedStateFromProps
gsbu Lifecycle: getSnapshotBeforeUpdate
cwm (DEPRECATED) Lifecycle: UNSAFE_ComponentWillMount
cwu (DEPRECATED) Lifecycle: UNSAFE_ComponentWillUpdate
cwrp (DEPRECATED) Lifecycle: UNSAFE_ComponentWillReceiveProps
prp PropType Declaration
prpr Required PropType Declaration
mstp Map state to props - A function that returns an object
mdtp Map dispatch to props - A variable that returns an object
hoc Wrapper function, AKA High order component
hookst useState hook creation

That's it for while

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft