News for hackers. Stuff that matters.

Reactive RxJS Elements for React

A simple counter button example:

    function App() {
      // clicks Subject
      const click$ = new Subject<number>();

      // output Observable
      const output$ = click$.pipe(
        startWith(0),     // start w/ 0
        map((_, i) => i), // map click to it's index
      );

      return <$button onClick={ click$ }>
        <$>{ output$ }</$>
      </$button>
    }

video: https://twitter.com/kddsky/status/1291040689543958529
( no comments | on HN )

There are no comments yet.