recks
Search…
Events
To listen to DOM events you simply need to prepend event name with on prefix:
1
<button
2
onClick={ handler }
3
>
4
click me
5
</button>
Copied!
handler would receive native Event.
NOTE: DOM event list on MDN

Events and Subjects

The best way to use events in you Recks components — is to push them into a local RxJS Subject:
1
function App() {
2
// events stream
3
const input$ = new Subject();
4
5
// accumulating stream
6
const times$ = input$.pipe(
7
startWith(0),
8
scan(acc => ++acc)
9
);
10
11
return (
12
<button onClick={ () => input$.next() }>
13
Clicks: { times$ }
14
</button>
15
);
16
}
Copied!
Last modified 1yr ago
Copy link