UNPKG

1.03 kBJSXView Raw
1import React, {PropTypes, Component} from 'react'
2import {addons} from 'react/addons'
3import styles from './index.css'
4const {shouldComponentUpdate} = addons.PureRenderMixin
5
6export default class {{PascalName}} extends Component {
7 static propTypes = {
8 name: PropTypes.string.isRequired
9 }
10 static defaultProps = {
11 name: '{{titleName}}'
12 }
13 constructor (props) {
14 super(props)
15 // initialize state values
16 this.state = {}
17 }
18 // use the pure-render mixin without the mixin. This allows us to use es6
19 // classes and avoid "magic" code. NOTE: if this component is used directly
20 // by react-router, you should delete it, otherwise, the <Link> component will
21 // not cause a re-render
22 shouldComponentUpdate (...args) {
23 return shouldComponentUpdate.apply(this, args)
24 }
25 render () {
26 return (<div>
27 <h1 className={styles.title} ref="title">{this.props.name} component</h1>
28 <img src={`http://loremflickr.com/600/600/${this.props.name}`} alt={this.props.name} />
29 </div>)
30 }
31}
32
33
\No newline at end of file