Rematch: Arguments Switched for Reducers and Effects

Created on 2 Mar 2018  路  3Comments  路  Source: rematch/rematch

Hello,

I just started utilizing this library, and I'm finding it much quicker and easier to use than vanilla Redux, so thanks!

I am wondering why arguments for effects and reducers are switched. Working from the React example given:
image

Not a huge issue, but if they were the same that would be helpful. Thanks!

question

Most helpful comment

Hi! Thanks for the library!

You're explanation does make sense, and yet... it just _looks_ wrong to me. I don't have any argument other than consistency. I guess it's interesting API design theory :)

At any rate, I wanted to weigh in because I had the exact same thought before I searched for the 'issue.'

All 3 comments

Hi @gpolonus, good question.

The idea here is to put params in the order that their most needed.

This avoids null params like: addByAsync(null, payload)

Reducers

  • always need: state (1st)
  • sometimes need: payload (2nd)
  • rarely need: meta (3rd)

Effects

  • usually need: payload (1st)
  • sometimes need: rootState (2nd) - note, different from reducer state
  • rarely need: meta (3rd)

Love to hear what you think

Makes sense to me. Thanks for the quick response!

Hi! Thanks for the library!

You're explanation does make sense, and yet... it just _looks_ wrong to me. I don't have any argument other than consistency. I guess it's interesting API design theory :)

At any rate, I wanted to weigh in because I had the exact same thought before I searched for the 'issue.'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

canyavall picture canyavall  路  6Comments

Dugnist picture Dugnist  路  3Comments

ShMcK picture ShMcK  路  4Comments

linonetwo picture linonetwo  路  5Comments

blairbodnar picture blairbodnar  路  3Comments