Last active
August 21, 2019 03:23
-
-
Save CatherineThompson/2e840358a530f100a6b302bd28c6b502 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 { timer } from 'rxjs' | |
| import { map } from 'rxjs/operators' | |
| const fruitList = ['pineapple', 'strawberry', 'banana', 'peach'] | |
| const vegetableList = ['peas', 'carrots', 'broccoli'] | |
| class App extends React.Component { | |
| fruit = timer(0, 2000).pipe( | |
| map(i => fruitList[i % fruitList.length]) | |
| ) | |
| vegetable = timer(0, 4500).pipe( | |
| map(i => vegetableList[i % vegetableList.length]) | |
| ) | |
| fruitAndVegetables = this.fruit.pipe( | |
| combineLatest( | |
| this.vegetable, | |
| (fruit, vegetable) => `${fruit} & ${vegetable}` | |
| ) | |
| ) | |
| render() { | |
| return ( | |
| <div> | |
| </div> | |
| ) | |
| } | |
| } | |
| export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment