Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>React Functional SnippetNew to Visual Studio Code? Get it now.
React Functional Snippet

React Functional Snippet

Marc Garcia i Mullon

|
3,664 installs
| (2) | Free
Snippets for react 2019/2020
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

React Snippets

React Function StateLess

rf→

import React from "react";
import PropTypes from "prop-types";

const Component = (props) => {
  return <div></div>;
};

Component.propTypes = {};

export { Component };

rfts→

import React from "react";

type Props = {};

const Component = (props: Props) => {
  return <div></div>;
};

export { Component };

React Function

rfs→

import React, { useState } from "react";
import PropTypes from "prop-types";

const Component = (props) => {
  const [state, setState] = useState(InitialState);
  return <div></div>;
};

Component.propTypes = {};

export { Component };

rfsts→

import React from "react";

type Props = {};

const Component = (props: Props) => {
  const [state, setState] = useState<Type>(InitialState);
  return <div></div>;
};

export { Component };

useState

rs→

const [state, setState] = useState(InitialState);

rsts→

const [state, setState] = useState < Type > InitialState;

useReducer

rur→

const [state, dispatch] = useReducer(Reducer, InitialState, Init);

useMemo

rum→

const FunctionName = useMemo(FunctionImp, [UpdateParams]);

useEffect

rue→

useEffect(FunctionImp, [UpdateParams]);
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft