Skip to content
Permalink
Browse files

feat: use audit

  • Loading branch information...
atomita committed Oct 26, 2019
1 parent 8767a50 commit 181633da52d7075bca5dd163365ca7e89e77dfdc
Showing with 10 additions and 2 deletions.
  1. +10 −2 app/app.tsx
@@ -1,7 +1,8 @@
import React, { useState, useCallback } from 'react'
import * as ReactDOM from 'react-dom'
import { useObservable } from "rxjs-hooks"
import { map } from "rxjs/operators"
import { useObservable } from 'rxjs-hooks'
import { interval } from 'rxjs'
import { audit, map } from 'rxjs/operators'

function Application () {
const [cnt, setCnt] = useState(0)
@@ -13,13 +14,20 @@ function Application () {
[cnt]
)

const cntAudit = useObservable(
cnt$ => cnt$.pipe(audit(v => interval(2000))),
[0],
[cnt]
)

return (
<div>
<div>
<button onClick={handleClick}>click</button>
</div>
<p>count: {cnt}</p>
<p>count * 10: {cnt10}</p>
<p>count audit (interval 2 seconds): {cntAudit}</p>
</div>
)
}

0 comments on commit 181633d

Please sign in to comment.
You can’t perform that action at this time.