Created
September 26, 2018 13:38
-
-
Save lmatteis/34aaf7c2c635d8eddf4f98304bf63a08 to your computer and use it in GitHub Desktop.
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 Coroutine from 'react-coroutine'; | |
import Deferred from './Deferred.js'; | |
export default Coroutine.create(Counter); | |
async function* Counter() { | |
let counter = 0; | |
while (true) { | |
yield ( | |
<section> | |
<p>{counter}</p> | |
<button onClick={() => dispatch('INCREMENT')}>Increment</button> | |
</section> | |
); | |
await waitFor('INCREMENT'); | |
counter++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment