Giter VIP home page Giter VIP logo

babel-sublime-snippets's Introduction

babel-sublime-snippets

Sublime snippets for React in ES5 and ES6 flavors.

Installation

Find it as [Babel Snippets](https://packagecontrol.io/packages/Babel Snippets) through Package Control.

Using the "React: wrap in a component" snippet

First, select a block of JSX. Then, from the Command Palette select "React: wrap in a component". Or, you can set up a key binding.

To set a key binding, go to "Preferences: Key Bindings - User" from the Command Palette and add an entry like this:

{
  "keys": ["ctrl+shift+,"],
  "command": "insert_snippet",
  "args": {
    "name": "Packages/Babel Snippets/react_wrap.sublime-snippet"
  }
}

Available snippets

React

Trigger Content
rcc→ class component skeleton
rcc→ legacy component skeleton
rcf→ state less component skeleton
cdm→ componentDidMount() {…}
cdup→ componentDidUpdate(prevProps, prevState) {…}
cwm→ componentWillMount() {…}
cwr→ componentWillReceiveProps(nextProps) {…}
cwun→ componentWillUnmount() {…}
cwup→ componentWillUpdate(nextProps, nextState) {…}
fdn→ React.findDOMNode(…)
gdp→ getDefaultProps() {…}
gis→ getInitialState() {…}
ren→ render() {…}
sst→ this.setState(…)
scu→ shouldComponentUpdate(nextProps, nextState) {…}
props→ this.props
state→ this.state
pt→ propTypes { ... }
pta→ PropTypes.arrayOf
ptai→ PropTypes.arrayOf (Instances)
ptb→ PropTypes.bool
pte→ PropTypes.element
ptf→ PropTypes.func
pti→ PropTypes.instanceOf
ptn→ PropTypes.number
ptn→ PropTypes.node
pto→ PropTypes.object
ptof→ PropTypes.oneOf (Enum)
ptof→ PropTypes.objectOf
ptoft→ PropTypes.oneOfType (Union)
pts→ PropTypes.string
ptsp→ PropTypes.shape

Notes

  • Unsupported React API snippets: displayName, forceUpdate, getDOMNode (use React.findDOMNode), ismounted, mixins, replaceProps, replaceState, setProps, statics.

Snippet(ing)

Read Extending Sublime Text » Snippets.

babel-sublime-snippets's People

Contributors

alexsuslov avatar cheerazar avatar hakkotsu avatar jamiebuilds avatar zertosh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.