{story.title}
{story.description}
React-RxJS: React bindings for RxJS
[](https://travis-ci.org/re-rxjs/react-rxjs)
[](https://codecov.io/gh/re-rxjs/react-rxjs)
[](https://www.npmjs.com/package/react-rxjs)
[](https://github.com/re-rxjs/react-rxjs/blob/main/LICENSE)
[](#contributors-)
[](http://makeapullrequest.com)
[](https://github.com/re-rxjs/react-rxjs/blob/main/CODE_OF_CONDUCT.md)
## Main features
- :cyclone: Truly Reactive
- :zap: Highly performant and free of memory-leaks
- :twisted_rightwards_arrows: First class support for React Suspense and [ready for Concurrent Mode](https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-mode#results)
- :scissors: Decentralized and composable, thus enabling optimal code-splitting
- :microscope: [Tiny and tree-shakeable](https://bundlephobia.com/result?p=react-rxjs)
- :muscle: Supports TypeScript
## Table of Contents
- [Installation](#installation)
- [API](#api)
- Core
- [bind](#bind)
- [Observable overload](#observable-overload)
- [Factory of Observables overload](#factory-of-observables-overload)
- [shareLatest](#sharelatest)
- React Suspense Support
- [SUSPENSE](#suspense)
- [suspend](#suspend)
- [suspended](#suspended)
- [switchMapSuspended](#switchmapsuspended)
- [Examples](#examples)
## Installation
npm install @react-rxjs/core
## API
### bind
#### Observable overload
```ts
const [useCounter, sharedCounter$] = bind(
clicks$.pipe(
scan(prev => prev + 1, 0),
startWith(0),
)
)
```
Accepts: An Observable.
Returns `[1, 2]`
1. A React Hook that yields the latest emitted value of the observable. If the
Observable doesn't synchronously emit a value upon the first subscription, then
the hook will leverage React Suspense while it's waiting for the first value.
2. A `sharedLatest` version of the observable. It can be used for composing other
streams that depend on it. The shared subscription is closed as soon as there
are no subscribers to that observable.
#### Factory of Observables overload
```tsx
const [useStory, getStory$] = bind(
(storyId: number) => getStoryWithUpdates$(storyId)
)
const Story: React.FC<{id: number}> = ({id}) => {
const story = useStory(id);
return (
{story.description}
No results were found.
} return (The most recently updated repo is {name}
) } export default function App() { return ( <>Josep M Sobrepere π» π€ π§ β οΈ π π |
VΓctor Oliva π€ π π» β οΈ π |
Ed π¨ |
Pierre Grimaud π |
Bhavesh Desai π π β οΈ |
Matt Mischuk π |