reduxjs / redux

A JS library for predictable global state management
https://redux.js.org
MIT License
60.9k stars 15.27k forks source link

Proposal: Add support for observable spec interop point #1631

Closed benlesh closed 8 years ago

benlesh commented 8 years ago

Per the stage 1 observable proposal, there is an interop point that can be added for types that are "observable". It's as simple as adding a [Symbol.observable]() hook that returns a basic observable (it doesn't have to be Rx-based or anything).

Pros

  1. Adding this hook will enable interoperability with RxJS 5, and it should do the same for Kefir, Bacon, Most, and others.
  2. People can stop asking me "what's the difference between RxJS and redux?"
  3. People that want to use a more reactive methodology for delivering state to components can do so without forgoing the wonderful tooling this community has put together
  4. It's a relatively minimal change

    Cons

Need to include a small Symbol.observable shim. Should probably add some integration test to a common library which adds one development-time dependency.

attn/ @gaearon @zenparsing

gaearon commented 8 years ago

Looks 👍 to me!

xirzec commented 8 years ago

This dependency seems to break using Redux with TypeScript and webpack: https://github.com/TypeStrong/ts-loader/issues/192