Skip to content

Instantly share code, notes, and snippets.

@Lucifier129
Created June 8, 2018 23:43
Show Gist options
  • Save Lucifier129/ebc52ff4f0478763361b52c16e9a6527 to your computer and use it in GitHub Desktop.
Save Lucifier129/ebc52ff4f0478763361b52c16e9a6527 to your computer and use it in GitHub Desktop.
import React from 'react'
import { render } from 'react-dom'
import { reactive } from 'rxjs-react'
import { from, of } from 'rxjs'
import { map, delay, scan, concatMap } from 'rxjs/operators'
const App = reactive(() => {
const hello$ = from('hello rxjs-react!').pipe(
concatMap(char => of(char).pipe(delay(300))),
scan((str, char) => str + char, ''),
map(text => <h1>{text}</h1>)
)
return <div>{hello$}</div>
})
render(<App />, document.getElementById('root'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment