0.0.9 • Published 4 years ago

use-stream-state v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 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

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago