ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

React ES6 Snippets

by mboperator ST2/ST3 Trending

ES6 based Sublime Text snippets for React.

Labels snippets, jsx, es6, react

Details

  • 0.5.0
  • github.​com
  • 2 years ago
  • 3 hours ago
  • 4 years ago

Installs

  • Total 67K
  • Win 30K
  • OS X 27K
  • Linux 9K
Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8
Windows 11 15 11 11 20 15 13 9 13 21 16 12 20 24 23 10 10 12 13 16 19 22 15 12 15 18 17 22 11 17 12 15 20 12 16 13 7 16 16 18 18 20 17 10 11 20
OS X 5 6 9 7 12 12 7 18 2 9 9 16 7 10 17 4 7 4 9 16 6 10 5 4 10 11 13 13 13 9 11 9 14 15 11 15 11 9 13 21 10 11 12 4 8 8
Linux 2 9 8 4 4 4 3 6 9 3 9 7 4 3 1 6 0 5 7 3 4 7 7 2 7 6 5 11 6 2 3 7 13 9 4 9 7 5 6 8 8 7 4 9 5 4

Readme

Source
raw.​githubusercontent.​com

sublime-react-es6

This is a fork of Facebook's original ReactJS Sublime Package.

The main changes I've made include:

  • Converting function declarations to the new ES6 shorthand.

  • Static class variables (defaultProps, propTypes) are declared using ES7 property intializers.

  • ES6 style exports and imports for component creating snippets.

  • Added rrc for Redux connected components.

alt tag

Installation

Install the React package via Sublime's Package Manager

You will need the Sublime Package Manager.

  • Open the command palette: ⌘+shift+p on MacOS/Linux, ctrl+shift+p on Windows

  • type install, select Package Control: Install Package

  • type React, select React ES6 Snippets

Usage

Syntax highlighting

Syntax highlighting is no longer provided by this packages. We recommend that you use (babel-sublime) instead.

Snippets

It's easy! Simply activate snippets by typing a mnemonic followed by TAB.

alt tag

Documentation of available snippets (JSX):

cdm→  componentDidMount: fn() { ... }

   cdup→  componentDidUpdate: fn(pp, ps) { ... }

     cs→  import cx from 'classnames';

    cwm→  componentWillMount: fn() { ... }

    cwr→  componentWillReceiveProps: fn(np) { ... }

    cwu→  componentWillUpdate: fn(np, ns) { ... }

   cwun→  componentWillUnmount: fn() { ... }

     cx→  cx({ ... })

    fdn→  React.findDOMNode(...)

    fup→  forceUpdate(...)

    gdp→  static defaultProps = { ... } 

    gis→  getInitialState: fn() { return {...} } 

    ism→  isMounted()

  props→  this.props.

     pt→  propTypes { ... }

    rcc→  component skeleton

   refs→  this.refs.

    ren→  render: fn() { return ... }

    rpc→  pure render component skeleton

    rrc→  redux component skeleton

    scu→  shouldComponentUpdate: fn(np, ns) { ... }

    sst→  this.setState({ ... })

  state→  this.state.

Contributing

Rebuilding the docs

After making changes to snippet files, run npm install && npm run build-docs to automatically generate this document from source. Do not make changes to README.md directly.