node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

react-starter-es6

react-starter-es6

build status js-standard-style

bare-bones react es6 starter using reactify for jsx using babelify for Babel under browserify/watchify with npm run scripts with browserSync for live reload with standard for linting

view the starter demo

quick start

$ npm install
$ npm run dev

commands

  • npm run build - build for production
  • npm run dev - start dev server with auto realod and automatically recompile during development
  • npm start - start a static development web server
  • npm test - code style revision and test

starter code

import React from 'react'
 
class App extends React.Component {
  constructor (props) {
    super()
    this.state = props
  }
  handleClick () {
    this.setState({
      n: this.state.n + 1
    })
  }
  render () {
    return (<div>
      <h1>clicked {this.state.n} times</h1>
      <button onClick={this.handleClick.bind(this)}>click me!</button>
    </div>)
  }
}
 
App.propTypes = { n: React.PropTypes.number }
App.defaultProps = { n: 1}
 
React.render(<App />, document.querySelector('#content'))