gajus / canonical-reducer-composition

Spec for Canonical Reducer Composition design pattern.
187 stars 3 forks source link

Impossible to use with Redux 3 #7

Open lukesneeringer opened 8 years ago

lukesneeringer commented 8 years ago

This is a brilliant pass at a better way to do reducers.

Sadly, because of the choice of name for actions rather than type (a choice which I prefer, in fairness), this is now flatly incompatible with Redux 3.

Redux 3 strictly requires a type property, and CRC and its validator strictly forbids it.

gajus commented 8 years ago

Redux 3 strictly requires a type property, and CRC and its validator strictly forbids it.

Unfortunately.

I have been meaning to come back to this for ages, but I am running sort of time. I will add it to my todo list. in the mean time, if someone decided to submit a PR, I will gladly accept it. (Note that the standard encompasses multiple repositories: https://github.com/gajus/canonical-reducer-composition and https://github.com/gajus/canonical-reducer-composition-validator)

gajus commented 8 years ago

Sadly, because of the choice of name for actions rather than type (a choice which I prefer, in fairness), this is now flatly incompatible with Redux 3.

We just released a new app using canonical-reducer-composition. We are using https://github.com/gajus/redux-immutable and a variation of https://github.com/kolodny/redux-create-reducer to abstract the store reducers.

Redux does not force use of action.type. There is only a single condition that validates action shape. You can set action.type to a dummy value to bypass it without any side-effects.