npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vscode-react-ts-snippets

v2.1.0

Published

Code snippets for react in typescript

Downloads

16

Readme

React + Typescript Code Snippets

Forked from https://github.com/infeng/vscode-react-typescript


version badge

This extension contains opinionated code snippets for React with Typescript.

VS Marketplace link: https://marketplace.visualstudio.com/items?itemName=weffe.vscode-react-ts-snippets

Installation

In order to install an extension you need to launch the Command Pallete (Ctrl + Shift + P or Cmd + Shift + P) and type Extensions. There you have either the option to show the already installed snippets or install new ones.

Launch VS Code Quick Open (Ctrl + P or Cmd + P), paste the following command, and press enter.

ext install weffe.vscode-react-ts-snippets

Alternatively you can open the extensions panel and search for 'React + Typescript Code Snippets'.

Alternative Installation

If you want to manually install the snippets then simply copy the snippets.json content from here: https://raw.githubusercontent.com/Weffe/vscode-react-ts-snippets/master/snippets/snippets.json

Next, in VS Code go to File -> Preferences -> User Snippets

In the popup window, search for typescriptreact and click on the option.

Finally, this will take you to a new window where you can paste in the copied snippets and then save!

Now, you will have access to the snippets across VS Code.

Supported languages (file extensions)

  • TypeScript (.ts)
  • TypeScript React (.tsx)

Snippets

Below is a list of all available snippets and the triggers of each one. The means the TAB key.

| Trigger | Content | | -------: | ------- | | tsrcc → | class component skeleton | | tsrcfull → | class component skeleton with Props, State, and constructor | | tsrcjc → | class component skeleton without import and default export lines | | tsrpcc → | class purecomponent skeleton | | tsrpcjc → | class purecomponent without import and default export lines | | tsrpfc → | pure function component skeleton | | tsrpfcwh → | pure function component skeleton with hooks | | tsrfc → | functional component skeleton | | conc → | class default constructor with props and context | | cwm → | componentWillMount method | | ren → | render method | | cdm → | componentDidMount method | | cwrp → | componentWillReceiveProps method | | scu → | shouldComponentUpdate method | | cwu → | componentWillUpdate method | | cdu → | componentDidUpdate method | | cwum → | componentWillUnmount method | | gdsfp → | getDerivedStateFromProps method | | gsbu → | getSnapshotBeforeUpdate method | | sst → | this.setState with object as parameter | | bnd → | binds the this of method inside the constructor | | met → | simple method | | imt → | import a dependency | | imta → | import everything from a dependency | | imtd → | import default object from a dependency | | tsrcm → | Create a React + MobX Component | | tsrcmfull →| Create a stateful React + MobX Component | | tsrcmrr → | Create a React + MobX + React-Router Component | | tsrcmrrfull → | Create a stateful React + MobX + React-Router Component |

License

MIT