Skip to content

mboperator/sublime-react-es6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

ES6 based Sublime Text snippets for React.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%