@sliversniper/react-unalias
v0.0.2
Published
decorators for short-alias react lifecycle, default state, props
Downloads
3
Readme
react-unalias
Motive
It 's easier to read and write.
cdm --> componentDidMount
Downside
Alias Map
'cwm': 'componentWillMount'
'cdm': 'componentDidMount'
'cwrp': 'componentWillReceiveProps'
'cwu': 'componentWillUpdate'
'cdu': 'componentDidUpdate'
'scu': 'shouldComponentUpdate'
'cwum': 'componentWillUnmount'
'ds': 'state'
'dp': 'defaultProps'
'pt': 'propTypes'
dp
as a normal js object
ds
, pt
as a function
pt
's this
is binded as React.PropTypes
Usage
option =
cdm: ->
log 'component did mount'
ds: ->
react-unalias(option) <|
class App extends React.Component
render: ->
@reactUnalias({
cdm(){
log('component did mount')
},
ds(){
return {hello: 'world'}
}
})
class App extends React.Component{
render(){
}
}