Skip to content

THammami01/react-ts-code-snippets

Repository files navigation

React TS Code Snippets for VS Code

All abbreviations share a rt (for React TS) prefix.

rtfc - Functional Component

import type { FC } from 'react';,

interface |Props {|}

const |: FC<|Props> = (|) => {
  return (|);
}

export default |;

rtus - useState Hook

const [|, set|] = useState(|);

rtue - useEffect Hook

useEffect(() => {
  |
}, [|]);

rtif - Import From

import | from '|';

rtipf - Import Props From

import { | } from '|';

rtxc - Export Const

export const | = |;

rtxd - Export Default

export default |;

rtxaf - Export All From

export * from "|";

rtxdf - Export Default From

export { default } from "|";

rtxdaf - Export Default As From

export { default as | } from '|';