Created
March 21, 2015 09:07
-
-
Save ronag/1acd9c8561af627922c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stampit from 'stampit' | |
import React from 'react' | |
import shallowEqual from 'react/lib/shallowEqual' | |
const Component = stampit.convertConstructor(React.Component) | |
const PureRenderMixin = stampit() | |
.methods({ | |
shouldComponentUpdate(nextProps, nextState) { | |
return !shallowEqual(this.props, nextProps) || | |
!shallowEqual(this.state, nextState) | |
} | |
}) | |
const MyComponent = stampit.compose(Component, PureRenderMixin, IntlMixing, MyMixing) | |
.state({ | |
propTypes: { | |
todo: React.PropTypes.instanceOf(immutable.Map) | |
} | |
}) | |
.methods({ | |
render() { | |
return ( | |
<li className={classnames({editing: false})}> | |
<label>{todo.get('title')}</label> | |
<button onClick={() => deleteTodo(this.props.todo)}>x</button> | |
</li> | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment