The following are the some commonly used shortcuts for working with React and Visual Studio Code:
React-specific shortcuts:
rafce
– Create a new React functional component with an export statement.rcc
– Create a new React class component with an export statement.imr
– Import the React module.imrc
– Import the React module and the current component.imrn
– Import the React module and a React Native component.useState
– Import the useState hook.useEffect
– Import the useEffect hook.useContext
– Import the useContext hook.useReducer
– Import the useReducer hook.useCallback
– Import the useCallback hook.useMemo
– Import the useMemo hook.
Visual Studio Code shortcuts:
Ctrl + /
(Windows) orCmd + /
(Mac) – Toggle line comment for the selected line(s) or the current line if nothing is selected.Ctrl + Shift + /
(Windows) orCmd + Shift + /
(Mac) – Toggle block comment for the selected lines.Ctrl + B
(Windows) orCmd + B
(Mac) – Toggle the sidebar.Ctrl + Shift + P
(Windows) orCmd + Shift + P
(Mac) – Open the command palette.Ctrl + P
(Windows) orCmd + P
(Mac) – Quick file navigation and search.Ctrl + F
(Windows) orCmd + F
(Mac) – Find text in the current file.Ctrl + H
(Windows) orCmd + F
(Mac) – Replace text in the current file.Ctrl + Shift + F
(Windows) orCmd + Shift + F
(Mac) – Find text in all files in the workspace.Ctrl + Shift + H
(Windows) orCmd + Shift + F
(Mac) – Replace text in all files in the workspace.Ctrl + S
(Windows) orCmd + S
(Mac) – Save the current file.
These are just a few shortcuts to get you started. Visual Studio Code has many more shortcuts, and you can customize them to fit your workflow.
You can find the full list of default shortcuts and customize them by going to “File” > “Preferences” > “Keyboard Shortcuts” in Visual Studio Code.