<button
onClick={ handler }
>
click me
</button>
The best way to use events in you Recks components — is to push them into a local RxJS Subject:
function App() {
// events stream
const input$ = new Subject();
// accumulating stream
const times$ = input$.pipe(
startWith(0),
scan(acc => ++acc)
);
return (
<button onClick={ () => input$.next() }>
Clicks: { times$ }
</button>
);
}