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.
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]
withuseObservableState
. - Call props function with
useObservablePropsCallback
. - Typeahead example. (Easily combine or chain Observables together to deal with complex scenarios.)
- Create an Observable from props and states with
- Testing
-
useObservable
will not trigger an extra rerender on init. -
useObservableState
will not trigger an extra rerender withstartWith
. -
useSubscription
will unsubscribe on unmount.
-