Split Bill app: React + Redux

Hello everyone ! I’ve just completed my first small Redux application.
Really need feedback on this one, cause I’m not sure if all Redux logic is correct.

Github repository

I’m especially not sure if it’s okay to use middlewares in order to update dependent state across different branches of the state tree. Is using something like a root reducer a better option ?


1 Like

Hi, I took a look at your work and was interesting. The custom middleware was a interesting choice and while it works, I’m entirly sure it was the best approach.

One middleware I do like using in my own projects now and then that you could have used possibly is called redux-thunk. Aside from being useful in async actions it can also be used to dispatch additonal actions from a single action. Though I think since all reducers recieve the same actions, you can just have your other reducer respond to the same action type.

The fork I made sorta removed the person list you had and just retruns in result each person ows x.

My approach on the fork I made is here https://github.com/jnmorse/split-bill/tree/my-approach

rather then having seperate reducers I put all the logic into a single reducer and removed the middleware.

One thing I notice is missing is the ability to add a decimal though. Right now it seems you only allow the user to enter the total in dollars only, no cents. Also might be good to add keyboard shortcuts so a user can use a keyboard to enter the amount.

Anyways hope any of this is useful to you.


Thank you so much for the feedback!