Created
October 25, 2018 16:11
-
-
Save viclotana/3ec7fd1e7f3d54a3f2b0eb64e735c46a to your computer and use it in GitHub Desktop.
This file contains 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
class MyClass extends React.Component { | |
static contextType = MyContext; | |
componentDidMount() { | |
let value = this.context; | |
/* perform a side-effect at mount using the value of MyContext */ | |
} | |
componentDidUpdate() { | |
let value = this.context; | |
/* ... */ | |
} | |
componentWillUnmount() { | |
let value = this.context; | |
/* ... */ | |
} | |
render() { | |
let value = this.context; | |
/* render something based on the value of MyContext */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment