Last active
February 27, 2018 12:16
-
-
Save atmd83/8ade2d7787c8b5b3453f4b616eec30e7 to your computer and use it in GitHub Desktop.
Medium post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PubSub from 'pubsub-js'; | |
export default class Thing extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
componentDidMount() { | |
PubSub.publish('thing.did.mount'); | |
} | |
componentWillReceiveProps(nextProps, nextState) { | |
PubSub.publish('thing.will.receive.props'); | |
return true | |
} | |
shouldComponentUpdate(nextProps, nextState) { | |
PubSub.publish('thing.should.update'); | |
return true; | |
} | |
componentWillUpdate(nextProps, nextState) { | |
PubSub.publish('thing.will.update'); | |
return true; | |
} | |
componentWillUnmount() { | |
PubSub.publish('thing.will.unmount'); | |
} | |
render() { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment