A comprehensive collection of React and TypeScript snippets for the Zed IDE to improve your development speed and productivity.
This extension provides a comprehensive set of snippets for React and TypeScript development, including:
git clone https://github.com/vishnuroshan/zed-react-ts-snippets.git
Start typing the snippet prefix (e.g., rfc
) in a TSX file and press Tab
to expand the snippet.
Prefix | Description |
---|---|
React Components | |
rfc |
React Functional Component (const) |
rff |
React Functional Component (function) |
frc |
ForwardRef Component with props |
hk |
Custom Hook Template |
rctx |
React Context with Provider and hook |
React Hooks | |
us |
useState Hook with TypeScript |
uem |
useEffect Hook runs once at mount |
uer |
useEffect Hook runs on every render |
cleanup |
useEffect Hook Cleanup |
useMemo |
useMemo Hook |
useCallback |
useCallback Hook |
useRef |
useRef Hook |
uih |
useImperativeHandle Hook |
useLayoutEffect |
useLayoutEffect Hook |
useDebugValue |
useDebugValue Hook |
useContext |
useContext Hook |
useReducer |
useReducer Hook |
TypeScript Types | |
tst |
New Type Alias |
tsi |
New Interface |
intr |
Interface |
typ |
Type |
enum |
Enum |
tsrcd |
Record utility type |
tgf |
Type Guard Function |
Functions & Classes | |
tsfn |
Function Declaration |
tsafn |
Arrow Function |
func |
Function |
tscls |
Class with Constructor |
tsserv |
Generic Service Class Template |
Imports & Exports | |
tsimprt |
Import Statement |
tsxprt |
Module Export |
Utilities | |
tsfetch |
Typed Fetch Function |
tstc |
Try/Catch block |
Type rfc
and press Tab:
import * as React from "react";
interface ComponentNameProps {
propName: type;
}
const ComponentName: React.FC<ComponentNameProps> = ({ propName }) => {
return <div></div>;
};
export default ComponentName;
Type us
and press Tab:
const [state, setState] = React.useState<type>(initialValue);
Type uem
and press Tab:
React.useEffect(() => {}, []);
Type tsi
and press Tab:
interface InterfaceName {
key: type;
}
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
Vishnu Roshan - vishnuroshan