Skip to content

Horizon's chat-app example, implemented with Redux and redux-saga

License

Notifications You must be signed in to change notification settings

shanecav/horizon-redux-saga

Repository files navigation

Horizon + redux-saga example

This example implements the chat-app example from Horizon.io with Redux and redux-saga.

This example is pretty over-engineered for a tiny chat app, but I wanted to structure it how I would a real Redux app. For a quick view of how the Horizon/redux-saga relationship works, jump over to app/chat/sagas/watchMessages.js. It's pretty straight-forward: you just create a redux-saga eventChannel that subscribes to a Horizon query Observable as its event source, and then have a saga take() that channel and respond to its events accordingly.

Installation + Usage

(You'll need to have Horizon installed first)

  1. git clone [email protected]:shanecav/horizon-redux-saga.git
  2. cd horizon-redux-saga && npm install
  3. hz init
  4. hz serve --dev
  5. In a new terminal in the same directory: npm start

Alternatives

If you're looking for a simpler alternative that doesn't depend on redux-saga, you might want to check out my horizon-redux library. It's not as powerful as redux-saga, but it's a lot smaller and easier to implement (in my opinion) if your needs are basic.

You can also check out redux-observable if RxJS is more your thing - Horizon should integrate really well with it since Collections are RxJS Observables.

Feedback

If you have any problems running this example, or have some suggestions, open an issue and I'll respond pretty quickly. Thanks!

About

Horizon's chat-app example, implemented with Redux and redux-saga

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published