File tree Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -33,25 +33,6 @@ function App() {
3333ReactDOM.render(<App />, document.querySelector('#app'))
3434` ` `
3535
36- #### Simple :
37- ` ` ` tsx
38- import React from 'react'
39- import ReactDOM from 'react-dom'
40- import { useObservable } from 'rxjs-hooks'
41- import { of } from 'rxjs'
42-
43- function App() {
44- const value = useObservable(() => of(1000))
45- return (
46- // render twice
47- // null and 1000
48- <h1>{value}</h1>
49- )
50- }
51-
52- ReactDOM.render(<App />, document.querySelector('#app'))
53- ` ` `
54-
5536#### With default value :
5637` ` ` tsx
5738import React from 'react'
@@ -125,9 +106,11 @@ import { useEventCallback } from 'rxjs-hooks'
125106import { mapTo } from 'rxjs/operators'
126107
127108function App() {
128- const [clickCallback, value] = useEventCallback((event$: Observable<React.React.SyntheticEvent<HTMLButtonElement>>) => event$.pipe(
129- mapTo(1000)
130- ))
109+ const [clickCallback, value] = useEventCallback((event$: Observable<React.React.SyntheticEvent<HTMLButtonElement>>) =>
110+ event$.pipe(
111+ mapTo(1000)
112+ )
113+ )
131114 return (
132115 // render null
133116 // click button
@@ -151,9 +134,12 @@ import { useEventCallback } from 'rxjs-hooks'
151134import { mapTo } from 'rxjs/operators'
152135
153136function App() {
154- const [clickCallback, value] = useEventCallback((event$: Observable<React.React.SyntheticEvent<HTMLButtonElement>>) => event$.pipe(
155- mapTo(1000)
156- ), 200)
137+ const [clickCallback, value] = useEventCallback((event$: Observable<React.React.SyntheticEvent<HTMLButtonElement>>) =>
138+ event$.pipe(
139+ mapTo(1000)
140+ ),
141+ 200,
142+ )
157143 return (
158144 // render 200
159145 // click button
You can’t perform that action at this time.
0 commit comments