Skip to content

huatw/react-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

react-prop-logger

APIs

logProps

HOC logProps, log props in lifecycle methods.

// only componentDidMount
@logProps('componentDidMount')
class App extends Component {...}

// componentDidMount and componentDidUpdate
@logProps([
  'componentDidMount',
  'componentDidUpdate',
])
class App extends Component {...}

// except for shouldComponentUpdate and componentWillUnmount
@logProps({
  shouldComponentUpdate: false,
  componentWillUnmount: false
})
class App extends Component {...}

log

normal property descriptor log to intercept a function.

// log all args
@log()
shouldComponentUpdate (nextProps) {...}

// log partial
@log((nextProps, nextState) => { console.log(nextState.name) })
shouldComponentUpdate (nextProps, nextState) {...}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published