JSPM

  • Created
  • Published
  • Downloads 38089
  • Score
    100M100P100Q151022F
  • License MIT

React hooks for RxJS Observables with powerful APIs.

Package Exports

  • observable-hooks

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (observable-hooks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

observable-hooks

React hooks for RxJS Observables with powerful APIs.

Read the doc here.

This project is still under heavy development. Use with caution. I will finish testing as soon as possible.

Here is how I designed the APIs.

mindmap

TODO

  • Examples
    • Create an Observable from props and states with useObservable.
    • Create an Observable from event callback with useObservableCallback.
    • Subscribe Observable with useSubscription.
    • useState-like [state, setState] with useObservableState.
    • Call props function with useObservablePropsCallback.
    • Typeahead example. (Easily combine or chain Observables together to deal with complex scenarios.)
  • Testing
    • useObservable will not trigger an extra rerender on init.
    • useObservableState will not trigger an extra rerender with startWith.
    • useSubscription will unsubscribe on unmount.