0.0.9 • Published 5 years ago

use-stream-state v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

use-stream-state

React-hooks with RXjs

Demo

  • check is online - link
const useOnline = () => {
  const [isOnline] = useStreamState(true, () =>
    merge(
      fromEvent(window, "online").pipe(mapTo(true)),
      fromEvent(window, "offline").pipe(mapTo(false))
    ).pipe(
      startWith(window.navigator.onLine),
      share()
    )
  );
  return isOnline;
}
0.0.9

5 years ago

0.0.8

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago