Skip to content

Instantly share code, notes, and snippets.

@ronag
Created March 21, 2015 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronag/1acd9c8561af627922c0 to your computer and use it in GitHub Desktop.
Save ronag/1acd9c8561af627922c0 to your computer and use it in GitHub Desktop.
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