Created
November 22, 2018 10:00
-
-
Save EnixCoda/62b1a4a538f55062fdbd07a8571a6cd9 to your computer and use it in GitHub Desktop.
render with global data and inner counter
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
const globalData = [] | |
class Component extends React.Component { | |
componentDidMount() { | |
setInterval(() => { | |
globalData.push(0) | |
this.setState((count = 0) => count + 1,) | |
}, 100) | |
} | |
render() { | |
return globalData.length | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment