Skip to content

Instantly share code, notes, and snippets.

@mngyuan
Created August 28, 2017 18:53
Show Gist options
  • Save mngyuan/202ee3c66ae2bc1ded22ac720a581359 to your computer and use it in GitHub Desktop.
Save mngyuan/202ee3c66ae2bc1ded22ac720a581359 to your computer and use it in GitHub Desktop.
random relay and redux notes

Redux / Flux and Relay?

Relay and Redux seem to solve very similar problems but in actuality the benefits from either are quite different.

Relay

  • business logic on server side
    • no duplication of business logic
    • even more separation between view and business
  • declarative data needs
    • same win as react's declarative vs imperative views

Redux

  • separates what happens from how things change
    • in your business logic / view code, read simple action name
    • in single place (reducer) read how that change occurs
  • unidirectional data flow separate business logic from view
    • same wins as react's unidirectional data flow - view code is dumb
  • global state is single source of truth

Interesting tweet from Dan Abramov that reframed how I think about the two: here

Relay has all the wins of redux, minus the single global state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment