ohansemmanuel / fake-medium

💥 A tiny (super tiny) medium article page + clap animation for demo purposes.
201 stars 86 forks source link

Add another reducer #2

Open michszy opened 5 years ago

michszy commented 5 years ago

Hello,

Allow me to first give you a round of applause and a huge thanks, your middleware is quite perfect, very beautiful coding. Yet I failed to see on how I could use it while working with several reducers because as you work with the article_details reducer when adding another reducer and duplicating the code to hold another set of actions, my two reducers collide and having this error :

Given action "API_START", reducer "reducerOne" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.

=> both reducers hold the same case API_START when the middleware dispatch it on onSuccess(data)

My guess is that I would have to split the actions for the middleware to remain untouched and then try to keep the structure of the reducers as it is. What is your opinion ?

While thanking you again,

nihalgadhavi9 commented 4 years ago

hello @michszy I'm facing the same issue as above, can you guide me related to this like how can we add multiple reducers while avoiding the API_START Issue?