Skip to content

Instantly share code, notes, and snippets.

@CatherineThompson
Last active August 21, 2019 03:23
Show Gist options
  • Select an option

  • Save CatherineThompson/2e840358a530f100a6b302bd28c6b502 to your computer and use it in GitHub Desktop.

Select an option

Save CatherineThompson/2e840358a530f100a6b302bd28c6b502 to your computer and use it in GitHub Desktop.
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