Logger for react lifecycle methods.
npm install react-logger-component   
npm install react-logger-component
Examples
React Logger exports two abstractions for React.Component and React.PureComponent.
`js
import React from 'react';
import {ReactLoggerComponent} from 'react-logger';
export default class App extends ReactLoggerComponent {
constructor(props) {
super(props);
this.displayName = 'MyApp';
}
render() {
return MyApp
}
}
`
When you need to have a lifecycle method in a component you must call the parent function in order to see the log for it.
All other lifecycle methods which are not defined in the App component will be logged.
`js
import React from 'react';
import {ReactLoggerComponent} from 'react-logger';
export default class App extends ReactLoggerComponent {
constructor(props) {
super(props);
this.displayName = 'MyApp';
}
componentWillUpdate(nextProps, nextState) {
super.componentWillUpdate(nextProps, nextState);
// your code
}
render() {
return MyApp
}
}
`
Pure components can also be inherited.
`js
import React from 'react';
import {ReactPureLoggerComponent} from 'react-logger';
export default class App extends ReactPureLoggerComponent {
constructor(props) {
super(props);
this.displayName = 'MyApp';
}
render() {
return MyApp
}
}
`
To run the example app:
- Clone the repo.
- npm install
- npm run build
- npm run build:example
- Open example/index.html`.