Created
November 30, 2018 15:51
-
-
Save zachariahtimothy/22b091d3735c2308ded0857cf70e141b to your computer and use it in GitHub Desktop.
Access unstated state
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
class TaylorMade extends React.Component { | |
myCounter = null; | |
shouldComponentUpdate() { | |
if (this.myCounter) { | |
console.log('Bomb.com, I have a counter!'); | |
} | |
return true; | |
} | |
render() { | |
return ( | |
<Subscribe to={[CounterContainer}> | |
{counter => { | |
this.myCounter = counter; | |
return ( | |
<div>I am a mossy pig!</div> | |
); | |
} | |
</Subscribe> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment