- 🐣 — initial commit
- ✨ — new version
- ♻️ — update dependencies
- ✔️ — bug fixed
- 🙈 — stupid bug fixed
- ➕ — new feature
- ➖ — remove feature/file/etc.
- 🔧 — refactoring
- 💄 — cosmetic refactoring
- 👾 — tests
- 📝 — README/docs update
displayName
// es6
static get displayName() {
return 'Component';
}
// old syntax
displayName: 'Component'
mixins
// es6 (yummies mixins only)
static get mixins() {
return [ MixinValidate ];
}
// old syntax (traditional mixins only)
mixins: [ DragDropMixin ],
propTypes
// es6
static get propTypes() {
return {
onChange: PropTypes.func.isRequired,
...
};
}
// old syntax
propTypes: {
onChange: PropTypes.func.isRequired,
...
}
defaultProps
static getter (getDefaultProps
method for old syntax)
// es6
static get defaultProps() {
return {
initialCount: 0
};
}
// old syntax
getDefaultProps() {
return {
initialCount: 0
};
}
getInitialState
(old syntax)
// old syntax
getInitialState() {
return {
count: 0
};
}
constructor
with initialstate
// es6
constructor(props) {
super(props);
// initial state
this.state = {
count: 0
};
}
static
methods includingstatic getter
methods (statics
object for old syntax)
// es6
static get configuration() {
return {
...
};
}
// old syntax
statics: {
configureDragDrop(registerType) {
...
}
...
}
React lifecycle methods in the order they're being invoked
componentWillMount
componentDidMount
componentWillReceiveProps
shouldComponentUpdate
componentWillUpdate
componentDidUpdate
componentWillUnmount
Internal methods (prefixed with underscore _
)
_onNewTab() {
...
}
_onDeleteTab(i) {
...
}
External API (methods you want to be available when using ref
)
getFormData() {
...
}
isValid() {
...
}
render() {
return {
block: 'awesome',
...
};
}
- custom props (prefixed with underscore
_
) - custom callbacks (prefixed with underscore
_
) - BEM props
- React attributes
- React callbacks
- ref
- key
Price({
// 1.
_currency: productInfo.currency,
// 2.
_onSomething: this._onSomething,
// 3.
block: 'what',
elem: 'what',
mods: {
visible: this.state.visible
},
mix: {
...
},
// 4.
value: this.state.value,
// 5.
onChange: this.onPriceChange,
// 6.
ref: 'price'
// 7.
key: 'price'
}, productInfo.price)